> On Tue, Nov 19, 2024 at 10:25:16AM +0100, Richard Biener wrote:
> > I think it's pretty clear and easy to describe to users what "m " and 
> > what "mC" do.  But with "pure" this is an odd intermediate state.  For both
> > "m " and "mP" you suggest above the new/delete might modify their
> > global state but as you can't rely on the new/delete pair to prevail
> > you cannot rely on the modification to happen.  But how do you explain
> > that
> 
> If we are willing to make the default not strictly conforming (i.e.
> basically revert PR101480 by default and make the GCC 11.1/11.2 behavior
> the default and allow -fno-sane-operators-new-delete to change to GCC
> 11.3/14.* behavior), I can live with it.
> But we need to make the documentation clear that the default is not strictly
> conforming.
It is not clear to me that "mP" means strict confromance.
In my understanding standard allows new/delete operators to be extended
to update some stats structure which records i.e. amount of allocated
memory.  Its walue will depend on optimization - if we optimize out
new/delete pair, memory will be not recorded which is stil meaningful
use case.

Now the extended new/delete may be invisible to compiler while the
compiler visible code may have other means of allocation (like our ggc)
and update same stats too.  With mP this may lead to situation where we
hoists compiler visible code optimizes out loads from this structure
across new call (since it is mP and we assume it to not modify it) and
later store missing its update which can lead to inconsistent state of
it.

so I would say that both mC and mP are (slightly?) non-conforming.
Honza

Reply via email to