https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120599
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:644a264d165fa6349b944ddb4158dd7f77d7f49f commit r16-3095-g644a264d165fa6349b944ddb4158dd7f77d7f49f Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sun Jul 27 20:37:55 2025 -0700 forwprop: Don't do copy-prop-aggregates from statements that could throw [PR120599] In the testcase provided, currently we lose the landing pad for the exception that could throw from the aggregate load as we remove one copy and the second statement where load happens was not marked as throwable before so the landing pad for that internal throw is now gone. The fix is to ignore statements that could throw (internally or externally). PR tree-optimization/120599 gcc/ChangeLog: * tree-ssa-forwprop.cc (optimize_agr_copyprop): Don't try to copy from statements that throw. gcc/testsuite/ChangeLog: * g++.dg/torture/noncall-eh-1.C: New test. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>