gcc/testsuite/gcc.c-torture/execute/20141107-1.c
raw| 1 | #define bool _Bool |
| 2 | |
| 3 | bool f(int a, bool c) __attribute__((noinline)); |
| 4 | bool f(int a, bool c) |
| 5 | { |
| 6 | if (!a) |
| 7 | c = !c; |
| 8 | return c; |
| 9 | } |
| 10 | |
| 11 | void checkf(int a, bool b) |
| 12 | { |
| 13 | bool c = f(a, b); |
| 14 | char d; |
| 15 | __builtin_memcpy (&d, &c, 1); |
| 16 | if ( d != (a==0)^b) |
| 17 | __builtin_abort(); |
| 18 | } |
| 19 | |
| 20 | int main(void) |
| 21 | { |
| 22 | checkf(0, 0); |
| 23 | checkf(0, 1); |
| 24 | checkf(1, 1); |
| 25 | checkf(1, 0); |
| 26 | return 0; |
| 27 | } |