| 1 |
/* PR c/60087 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wsign-compare" } */ |
| 4 |
|
| 5 |
void |
| 6 |
foo (unsigned int ui, int i) |
| 7 |
{ |
| 8 |
const unsigned char uc = 0; |
| 9 |
_Bool b; |
| 10 |
b = 0 != ~uc; /* { dg-warning "9:promoted bitwise complement of an unsigned value is always nonzero" } */ |
| 11 |
b = 2 != ~uc; /* { dg-warning "9:comparison of promoted bitwise complement of an unsigned value with constant" } */ |
| 12 |
b = uc == ~uc; /* { dg-warning "10:comparison of promoted bitwise complement of an unsigned value with unsigned" } */ |
| 13 |
b = i == ui; /* { dg-warning "9:comparison of integer expressions of different signedness" } */ |
| 14 |
} |