https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94899
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- /* X + Z < Y + Z is the same as X < Y when there is no overflow. */ (for op (lt le ge gt) (simplify (op (plus:c @0 @2) (plus:c @1 @2)) (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))) (op @0 @1)))) ... /* X - Z < Y - Z is the same as X < Y when there is no overflow. */ (for op (lt le ge gt) (simplify (op (minus @0 @2) (minus @1 @2)) (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))) (op @0 @1)))) This is invalid as 0x80000000 is unsigned (C90/C++03) or long (C99/C++11) in type. Which means then overflow is not undefined but rather wrapping. THIS ALSO means clang is broken.