https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69615
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-02-02 CC| |rguenth at gcc dot gnu.org Component|rtl-optimization |tree-optimization Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC relies on some fold() routine to do this and we end up with ;; Function r0_to_imax_2 (null) ;; enabled by -tree-original { if ((unsigned int) x <= 2147483645) { ext (); } } ;; Function r0_to_imax_1 (null) ;; enabled by -tree-original { if (x >= 0 && x != 2147483647) { ext (); } } ;; Function r0_to_imax (null) ;; enabled by -tree-original { if (x >= 0) { ext (); } so it seems we are confused by the trick that triggers first, replacing the <= INT_MAX-1 compare with a != INT_MAX compare and that not being handled in the range construction code. Looks like ifcombine doesn't handle it either (maybe_fold_and_comparisons). void ext(void); void r0_to_imax_1(int x){ if (x>=0 && x<=(__INT_MAX__-1)) ext(); }