[Bug tree-optimization/126459] New: [17 Regression] Wrong code with x != CST1 ? x + CST2 : CST3 fold
"ktkachov at gcc dot gnu.org via Gcc-bugs" <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
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