https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126459
Bug ID: 126459
Summary: [17 Regression] Wrong code with x != CST1 ? x + CST2 :
CST3 fold
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
__attribute__((noipa)) int
h (int x)
{
int t = (x != __INT_MAX__) ? x + 1 : (-__INT_MAX__ - 1);
return t > x;
}
int
main (void)
{
if (h (__INT_MAX__) != 0)
__builtin_abort ();
if (h (1) != 1)
__builtin_abort ();
return 0;
}
aborts with optimisation with GCC 17