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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Likely buffer_alloc is marked with the malloc attribute and since the
pointer does not escape the function it is dead (leaked) memory and
GCC elides stores to it.

 return p - (p_instr *)buffer_ptr(&instrbuf);

does not constitute an escape point since without 'p' escaping itself
p cannot be reconstructed (as random address) from just
buffer_ptr(&instrbuf).

I assume buffer_alloc allocates from the storage of 'instrbuf' itself
or storage pointed to by it.  But the malloc attribute assures that
no other pointer to *p exists in the program [or can be constructed
by means of offsetting].

So I think this is INVALID.

Reply via email to