http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53806
Bug #: 53806 Summary: Missed optimization (a<=b)&&(a>=b) with trapping 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; } is optimized to: if(a==b) return 1; only if I specify the flag -fno-trapping-math, not by default. The test in combine_comparisons checks for any change in trapping behavior, whereas according to PR tree-optimization/53805 we are allowed to remove traps, just not add new ones (as would happen with ORD && UNLT -> LT for instance).