summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr68412.c
blob: 825eb63073010526a5ffc9fc134324383e6e2148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* PR c/68412 */
/* { dg-do compile } */
/* { dg-options "-Wall -Wextra" } */

#define M (sizeof (int) * __CHAR_BIT__)

int
fn1 (int i)
{
  return i == (-1 << 8); /* { dg-warning "left shift of negative value" } */
}

int
fn2 (int i)
{
  return i == (1 << M); /* { dg-warning "left shift count" } */
}

int
fn3 (int i)
{
  return i == 10 << (M - 1); /* { dg-warning "requires" } */
}

int
fn4 (int i)
{
  return i == 1 << -1; /* { dg-warning "left shift count" } */
}

int
fn5 (int i)
{
  return i == 1 >> M; /* { dg-warning "right shift count" } */
}

int
fn6 (int i)
{
  return i == 1 >> -1; /* { dg-warning "right shift count" } */
}