gcc/testsuite/gcc.c-torture/execute/builtin-constant.c
raw| 1 | /* PR optimization/8423. */ |
| 2 | |
| 3 | void abort (void); |
| 4 | void exit (int); |
| 5 | |
| 6 | #define btest(x) __builtin_constant_p(x) ? "1" : "0" |
| 7 | |
| 8 | #ifdef __OPTIMIZE__ |
| 9 | void |
| 10 | foo (char *i) |
| 11 | { |
| 12 | if (*i == '0') |
| 13 | abort (); |
| 14 | } |
| 15 | #else |
| 16 | void |
| 17 | foo (char *i) |
| 18 | { |
| 19 | } |
| 20 | #endif |
| 21 | |
| 22 | int |
| 23 | main (void) |
| 24 | { |
| 25 | int size = sizeof (int); |
| 26 | foo (btest (size)); |
| 27 | foo (btest (size)); |
| 28 | exit (0); |
| 29 | } |