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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-10-08
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The reason is that GCC assumes the result of operator new[] does not alias
any other pointer but the inlined destructor compares this pointer against
&objs[j] - a comparison that can never be true because of said property
of the allocation function.  So these tests are elided and the destructor
never "finds" the allocated object.

So confirmed.  Not sure if expected and desirable - on the C side we simply
assume the actual allocation runtime and its side-effects are not visible
to the compiler.  For C++ with custom allocators this might be hard to
achieve.

Reply via email to