[Bug c++/94671] Wrong behavior with operator new overloading when using O2 for optimization

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 20 13:55:41 GMT 2020


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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> The question is whether the standard allows eliding of the side-effect
> setting newCalled to true.

It does.

That side effect happens inside a replaceable global allocation function. The
compiler is allowed to optimise away calls to replaceable global allocation
functions.


More information about the Gcc-bugs mailing list