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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrea Pinski <[email protected]>:

https://gcc.gnu.org/g:95c85b404da4fe6eea7b7f3b51e1270b77f0dab8

commit r17-3902-g95c85b404da4fe6eea7b7f3b51e1270b77f0dab8
Author: Andrea Pinski <[email protected]>
Date:   Tue Sep 1 23:07:29 2026 -0700

    eh: Use tree_could_throw_1/lhs_could_trap_p for lhs in non-call exception
case [PR127183]

    Since `this` argument was added as a non-trapping, we incorrectly had
thought
    it would not cause an non-call exception when it was on the LHS.  With the
fix for
    PR127133, we can change the places which were checking for trapping on the
lhs
    to use lhs_could_trap_p/tree_could_throw_1 instead of using
tree_could_throw_p.
    That fixes the non-call exceptions on the lhs of assignments with respect
to
    this argument.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/127183

    gcc/ChangeLog:

            * tree-eh.cc (lower_eh_constructs_2): Use lhs_could_trap_p for lhs.
            (stmt_could_throw_1_p): Use tree_could_throw_1 for lhs.
            (tree_could_throw_p): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/noncall-this-method-1.C: New test.

    Signed-off-by: Andrea Pinski <[email protected]>

Reply via email to