gcc/testsuite/c-c++-common/pr107465.c
raw| 1 | /* PR c/107465 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wsign-compare" } */ |
| 4 | |
| 5 | void baz (void); |
| 6 | typedef unsigned short T; |
| 7 | |
| 8 | #if __SIZEOF_SHORT__ * __CHAR_BIT__ == 16 |
| 9 | void |
| 10 | foo (unsigned short x) |
| 11 | { |
| 12 | if (!(x ^ 0xFFFF)) |
| 13 | baz (); |
| 14 | } |
| 15 | |
| 16 | void |
| 17 | bar (T x) |
| 18 | { |
| 19 | if (!(x ^ 0xFFFF)) /* { dg-bogus "promoted bitwise complement of an unsigned value is always nonzero" } */ |
| 20 | baz (); |
| 21 | } |
| 22 | #endif |