gcc/testsuite/gcc.dg/pr15785-1.c
raw| 1 | /* { dg-do link } */ |
| 2 | |
| 3 | extern void link_error (); |
| 4 | |
| 5 | void a (int x) { |
| 6 | if (~ (~x) - x) |
| 7 | link_error (); |
| 8 | } |
| 9 | void b (int x) { |
| 10 | if (- (-x) - x) |
| 11 | link_error (); |
| 12 | } |
| 13 | |
| 14 | void c (int x) { |
| 15 | if (!(- (~x) - x)) |
| 16 | link_error (); |
| 17 | } |
| 18 | |
| 19 | void d (int x) { |
| 20 | if (!(~ (-x) - x)) |
| 21 | link_error (); |
| 22 | } |
| 23 | |
| 24 | void e (int x) { |
| 25 | if (x + ~(x - 1)) |
| 26 | link_error (); |
| 27 | } |
| 28 | |
| 29 | void f (int x) { |
| 30 | if (x + ~(x + (-1))) |
| 31 | link_error (); |
| 32 | } |
| 33 | |
| 34 | int main (int argc, char *argv[]) { |
| 35 | a(argc); |
| 36 | b(argc); |
| 37 | c(argc); |
| 38 | d(argc); |
| 39 | e(argc); |
| 40 | f(argc); |
| 41 | return 0; |
| 42 | } |