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

--- Comment #10 from Jens Maurer <jens.maurer at gmx dot net> ---
I agree with Jonathan here: The difference is that "malloc" comes with the
compiler/library and cannot be replaced (within the scope of the C or C++
standards), but "operator new" is expressly specified to be replaceable by the
C++ standard. There is text in the standard that restricts what "operator new"
can and cannot do, but otherwise it is specified as-if a regular function call.

As-is, gcc 11 is non-conforming with this optimization turned on by default.

I'm all for providing an extra command-line switch so that the user can assert
that he's not replacing "operator new" anywhere in the program, but that switch
should be off by default.

Reply via email to