aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/undefined-1.c
blob: b67b013282268d783d074757addb82bf9b312ea6 (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
/* { dg-do run } */
/* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */

int
foo (int x, int y)
{
  const int z = 2;
  if (z & 1)
    return x << y;
  return 0;
}

int
bar (int x, int y)
{
  return x + y;
}

int
main (void)
{
  foo (3, 2);
  bar (12, 42);
  return 0;
}