| 1 |
/* This code shows up in worse_state in ipa-pure-const.cc: |
| 2 |
*looping = MAX (*looping, looping2); |
| 3 |
was miscompiling it as just `return 1` though instead of |
| 4 |
`MAX_EXPR<*a, b>` (which should be transformed into `*a | b` |
| 5 |
note MAX_EXPR<bool, bool> is really `bool | bool` so we |
| 6 |
use that to compare against here. |
| 7 |
*/ |
| 8 |
#define bool _Bool |
| 9 |
bool __attribute__((noipa)) f(bool *a, bool b) |
| 10 |
{ |
| 11 |
bool t = *a; |
| 12 |
if (t <= b) |
| 13 |
return b; |
| 14 |
return t; |
| 15 |
} |
| 16 |
bool __attribute__((noipa)) f1(bool *a, bool b) |
| 17 |
{ |
| 18 |
return *a | b; |
| 19 |
} |
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
int i = 0; |
| 24 |
int j = 0; |
| 25 |
|
| 26 |
for (i = 0; i <= 1; i++) |
| 27 |
for (j = 0; j <= 1; j++) |
| 28 |
{ |
| 29 |
bool a = i; |
| 30 |
if (f(&a, j) != f1(&a, j)) |
| 31 |
__builtin_abort(); |
| 32 |
} |
| 33 |
return 0; |
| 34 |
} |