This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug other/56955] documentation for attribute malloc contradicts itself


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

--- Comment #14 from Paul Eggert <eggert at gnu dot org> ---
(In reply to Dan Gohman from comment #13)

> *p can't alias a or b without violating the weaker assumption.

Sorry, you've lost me there.  Pointers in realloc'ed storage can alias
already-existing pointers, and surely this aliasing can inhibit optimization;
perhaps my example doesn't show this correctly but I expect that other examples
could.

> the weaker assumption would be usable by a much broader set of functions,
> so it may even provide overall stronger alias information in practice.

>From what I've seen so far I tend to agree, but there are contrary opinions,
e.g., Richard Biener's "We cannot use the malloc attribute on realloc, ever."
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383#23>. It might be helpful
for Richard to chime in here and explain. Even if GCC does not change the
meaning of __attribute__ ((malloc)), perhaps there should be a new directive
(__attribute__ ((new)), say) with the weaker semantics.

Anyway, the original bug report is about GCC's documentation, and the proposed
patch does fix the documentation bug, so we could start with it.


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