See PR42108. Basically we still can PRE a possibly trapping division in if (b) tmp = a/b; tmp = a/b;
because there is no invisible exit along the paths to the insertion point. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42108#c41 hints at what we should instead do. -- Summary: Fix for PR38819 is too conservative Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42438