summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr60087.c
blob: b3bd811caea6b58e0883bec62e00ae7bf0ca0bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* PR c/60087 */
/* { dg-do compile } */
/* { dg-options "-Wsign-compare" } */

void
foo (unsigned int ui, int i)
{
  const unsigned char uc = 0;
  _Bool b;
  b = 0 != ~uc; /* { dg-warning "9:promoted bitwise complement of an unsigned value is always nonzero" } */
  b = 2 != ~uc; /* { dg-warning "9:comparison of promoted bitwise complement of an unsigned value with constant" } */
  b = uc == ~uc; /* { dg-warning "10:comparison of promoted bitwise complement of an unsigned value with unsigned" } */
  b = i == ui; /* { dg-warning "9:comparison of integer expressions of different signedness" } */
}