[Bug tree-optimization/127134] [16/17 Regression] lim at -Ofast incorrectly assumes a store to this (const) will not trap
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 2 02:55:24 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127134
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrea Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:59b82e3f4f88a02158c56921effcc078ab1a5580
commit r17-3841-g59b82e3f4f88a02158c56921effcc078ab1a5580
Author: Andrea Pinski <andrew.pinski@oss.qualcomm.com>
Date: Tue Sep 1 14:14:50 2026 -0700
tree-eh: Fix up lhs_could_trap_p for *this [PR127133]
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 <andrew.pinski@oss.qualcomm.com>
More information about the Gcc-bugs
mailing list