This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH v2] Add reallocarray function.


Andreas Schwab wrote:
Please report that as a gcc bug (it doesn't mark it either).

As far as I can tell this is a bug in GCC's documentation, not in its implementation. As I mentioned cryptically in my previous message, if FOO has the malloc attribute and you execute 'int **p = foo (...);', the malloc attribute means that *P cannot point to previously-existing storage (because *P is uninitialized junk). That is why the attribute applies to calloc (because *P must be null, which also cannot point to previously-existing storage) but not to realloc (because *P might be initialized and might point to previously-existing storage).

For more about this confusing topic, please see:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56955


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]