gcc/testsuite/gcc.c-torture/compile/pr50380.c
raw| 1 | __attribute__ ((__noreturn__)) extern void fail (void); |
| 2 | |
| 3 | char x; |
| 4 | |
| 5 | /* This used to get stuck in an infinite loop in find_comparison_args |
| 6 | when compiling this function for MIPS at -O2. */ |
| 7 | |
| 8 | void foo (const unsigned char y) |
| 9 | { |
| 10 | ((void) (__builtin_expect((!! y == y), 1) ? 0 : (fail (), 0))); |
| 11 | x = ! y; |
| 12 | } |
| 13 | |
| 14 | /* This used to similarly get stuck when compiling for PowerPC at -O2. */ |
| 15 | |
| 16 | int foo2 (int arg) |
| 17 | { |
| 18 | if (arg != !arg) |
| 19 | fail (); |
| 20 | if (arg) |
| 21 | fail (); |
| 22 | } |