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

--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #22)
> But as Jonathan says in comment 10, the replaceable operator new is shared
> by the whole program, so I don't see why we would need a per-call flag for
> the global memory aliasing property; either the function touches global
> memory or it doesn't.

Well, to be precise, it would need to be a per-call property if we want to
allow people to redefine those and don't use those call flags within the TUs
where they define it but want to use it in other TUs where the state it
modifies is just an implementation detail.
But if we explain it well (and I think we need to do the same for malloc etc.
already) that if one overrides those (whether malloc or ::operator new or
::operator delete) that the implementation should be compiled without -flto and
for the latter two with -fno-sane-operator-new, it could be a global flag,
because for everything else it is really a property of those calls, if it is
sane (doesn't modify nor read global state from POV of other TUs) for a single
call, then it should be sane for all other calls (except the implementation).

Reply via email to