gcc/gcc/testsuite/c-c++-common/Wshift-count-negative-1.c

9 lines
243 B
C

/* { dg-do compile } */
/* { dg-options "-Wshift-count-negative" } */
void foo()
{
unsigned i1 = 1U << -1; /* { dg-warning "left shift count is negative" } */
unsigned i2 = 1U >> -1; /* { dg-warning "right shift count is negative" } */
}