https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119903
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- There is likely similar issues with -ftrapv -fnon-call-exceptions and _1 = _2 + 3; _3 = _1 - 3; where in general forwprop fails to properly replace an internally throwing stmt with its folded variant. With -fno-delete-dead-exceptions your testcase gives the following, highlighting the issue some more: <bb 2> : _6 = a_5(D) < 1.0e+0; <bb 3> : _13 = a_5(D) < 1.0e+0; if (_13 != 0) goto <bb 4>; [INV] I believe that in general the match.pd SSA def following should not follow to internally throwing defs. Either in the core workers or by means of the valueization hook of individual passes. Probably the former (though it makes such lookup a bit expensive and fragile for stmts not in the CFG).