gcc/testsuite/c-c++-common/torture/pr60971.c
raw| 1 | /* PR tree-optimization/60971 */ |
| 2 | /* { dg-do run } */ |
| 3 | |
| 4 | #ifndef __cplusplus |
| 5 | #define bool _Bool |
| 6 | #endif |
| 7 | |
| 8 | volatile unsigned char c; |
| 9 | |
| 10 | __attribute__((noinline)) unsigned char |
| 11 | foo (void) |
| 12 | { |
| 13 | return c; |
| 14 | } |
| 15 | |
| 16 | __attribute__((noinline)) bool |
| 17 | bar (void) |
| 18 | { |
| 19 | return foo () & 1; |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main () |
| 24 | { |
| 25 | c = 0x41; |
| 26 | c = bar (); |
| 27 | if (c != 1) |
| 28 | __builtin_abort (); |
| 29 | c = 0x20; |
| 30 | c = bar (); |
| 31 | if (c != 0) |
| 32 | __builtin_abort (); |
| 33 | return 0; |
| 34 | } |