https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117424
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:eafe890ea3904c109b6bce663a81a91d61356cb4 commit r12-11226-geafe890ea3904c109b6bce663a81a91d61356cb4 Author: Richard Biener <rguent...@suse.de> Date: Tue Jan 28 12:28:14 2025 +0100 tree-optimization/117424 - invalid LIM of trapping ref The following addresses a bug in tree_could_trap_p leading to hoisting of a possibly trapping, because of out-of-bound, access. We only ensured the first accessed byte is within a decl there, the patch makes sure the whole base of the reference is within it. This is pessimistic if a handled component would then subset to a sub-object within the decl but upcasting of a decl to larger types should be uncommon, questionable, and wrong without -fno-strict-aliasing. The testcase is a bit fragile, but I could not devise a (portable) way to ensure an out-of-bound access to a decl would fault. PR tree-optimization/117424 * tree-eh.cc (tree_could_trap_p): Verify the base is fully contained within a decl. * gcc.dg/tree-ssa/ssa-lim-25.c: New testcase. (cherry picked from commit f1e776ce58ae4a6ae67886adb4ae806598e2c7ef)