On Tue, Sep 1, 2026 at 6:28 PM Jeff Law <[email protected]> wrote:
>
>
>
> On 9/1/26 5:57 PM, Andrea Pinski wrote:
> > Currently we were treating `this->a` as being non-trapping.
> > This is ok for the rhs but on the lhs it depends on the memory
> > was read only or not which we don't have access to right away.
> > So right now lhs_could_trap_p would call tree_could_trap_p
> > and then have some special cases for some read only/trapping
> > cases.  Instead let's split up tree_could_trap_p and then
> > have the special cases directly in the new function.
> >
> > Bootstrapped and tested on x86_64-linux-gnu.
> >
> >       PR tree-optimization/127133
> >       PR tree-optimization/127134
> >
> > gcc/ChangeLog:
> >
> >       * tree-eh.cc (tree_could_trap_p): Split into ...
> >       (tree_could_trap_1): This. Take into account lhs
> >       in some cases.
> >       (lhs_could_trap_p): Just call tree_could_trap_1.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * g++.dg/torture/const-method-this-1.C: New test.
> >       * g++.dg/torture/const-method-this-2.C: New test.
> >
> > Signed-off-by: Andrea Pinski <[email protected]>
> OK

Pushed with a small addition to both testcases of:
// { dg-additional-options "-fallow-store-data-races" }
To both of them.  I forgot to include them in the patch but I tested
with that there.
This was needed to invoke the bug in the first place.

> jeff

Reply via email to