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

--- Comment #3 from Jens Maurer <jens.maurer at gmx dot net> ---
"We treat the global operator new as not reading from global memory"

If I implement my own global "operator new" afresh, certainly it'll need to
access global memory, e.g. to read a global pointer to the heap or so.

I have carefully reviewed [expr.new] before posting this bug report. The
compiler can omit a call to an allocation function entirely (and e.g. provide
the memory on the stack, if the lifetime fits), but I haven't found any wording
that would allow making assumptions about the global memory behavior of the
allocation function when it is, in fact, called.

"we cannot do the optimization that was added"

I understand this might be an important optimization to offer (similar to
-ffast-float), but it would be good to have a separate command-line flag to
enable or disable it.

Reply via email to