summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wshift-count-overflow-1.c
blob: 4d29d5786256cdb333ab2c9fd684ef1cfe6c3129 (plain)
1
2
3
4
5
6
7
8
/* { dg-do compile } */
/* { dg-options "-Wshift-count-overflow" } */

void foo()
{
  unsigned i1 = 1U << (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "left shift count >= width of type" } */
  unsigned i2 = 1U >> (sizeof(unsigned) * __CHAR_BIT__); /* { dg-warning "right shift count >= width of type" } */
}