https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79334
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:ad665deeafd31238b537139385e1e80b40c10e0c commit r12-3071-gad665deeafd31238b537139385e1e80b40c10e0c Author: Richard Biener <rguent...@suse.de> Date: Mon Aug 23 09:57:05 2021 +0200 tree-optimization/79334 - avoid PRE of possibly trapping array-ref This replicates tree-eh.c in_array_bound_p into VNs vn_reference_may_trap to fix hoisting of a possibly trapping ARRAY_REF across a call that might not return. 2021-08-23 Richard Biener <rguent...@suse.de> PR tree-optimization/79334 * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Record a type also for COMPONENT_REFs. (vn_reference_may_trap): Check ARRAY_REF with constant index against the array domain. * gcc.dg/torture/pr79334-0.c: New testcase. * gcc.dg/torture/pr79334-1.c: Likewise.