http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53805
Bug #: 53805 Summary: combine_comparisons changes trapping behavior Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: gli...@gcc.gnu.org Hello, int f(double a,double b){ if(a>b) if(a<b) return 1; return 0; } gets simplified by tree-ssa-ifcombine to just return 0; which is wrong if the comparison would trap. This is caused by combine_comparisons: bool trap = (compcode & COMPCODE_UNORD) == 0 && (compcode != COMPCODE_EQ) && (compcode != COMPCODE_ORD); which is missing: && (compcode != COMPCODE_FALSE) (this isn't needed for ltrap and rtrap)