https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111109
Bug ID: 111109
Summary: [13/14 Regression] wrong code for some fp comparisons
(after r13-4620-g4d9db4bdd458)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
[[gnu::noipa]]
int f(int a, int b, float fa, float fb) {
const bool c = fa < fb;
const bool c1 = fa >= fb;
return (c * a) | (c1 * b);
}
int main(void)
{
float a = __builtin_nan("");
float b = __builtin_nan("");
if (f(-1,-1, a, b) != 0)
__builtin_abort();
}
```
This works at -O0 but fails at -O2.
The reasoning is that after r13-4620-g4d9db4bdd458 we think > and <= are
inverses of each other but they are not.