gcc/testsuite/gcc.dg/20040627-1.c
raw| 1 | /* { dg-do link } */ |
| 2 | /* { dg-options "-O2" } */ |
| 3 | |
| 4 | extern void link_error (void); |
| 5 | |
| 6 | |
| 7 | void test(int x) |
| 8 | { |
| 9 | if ((x & ~x) != 0) |
| 10 | link_error (); |
| 11 | if ((~x & x) != 0) |
| 12 | link_error (); |
| 13 | |
| 14 | if ((x ^ ~x) != -1) |
| 15 | link_error (); |
| 16 | if ((~x ^ x) != -1) |
| 17 | link_error (); |
| 18 | |
| 19 | if ((x | ~x) != -1) |
| 20 | link_error (); |
| 21 | if ((~x | x) != -1) |
| 22 | link_error (); |
| 23 | |
| 24 | if (x && !x) |
| 25 | link_error (); |
| 26 | if (!x && x) |
| 27 | link_error (); |
| 28 | |
| 29 | if (!(x || !x)) |
| 30 | link_error (); |
| 31 | if (!(!x || x)) |
| 32 | link_error (); |
| 33 | } |
| 34 | |
| 35 | int main() |
| 36 | { |
| 37 | test (0); |
| 38 | test (1); |
| 39 | test (-1); |
| 40 | return 0; |
| 41 | } |
| 42 |