summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/const-expr-1.c
blob: f474ec64ef5b7302c23c4a9fa9e91a82adbd29b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-fsanitize=shift -w" } */

enum e { A = 1 << 1, B, };
const int arr[] = {
  1 << 2,
  1 << 3,
};

int
bar (int a, int b)
{
  return a >> b;
}

int
foo (void)
{
  int i = 1;
  int vla[B << 3];
  return bar (A, (i <<= 6, i + 2));
}