Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / c-c++-common / ubsan / undefined-1.c
blobd1b9ce78771f5fdf68aa46edf1c7290169739466
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=undefined" } */
4 #include <stdio.h>
6 int
7 foo (int x, int y)
9 const int z = 2;
10 if (z & 1)
11 return x << y;
12 return 0;
15 int
16 bar (int x, int y)
18 return x + y;
21 int
22 main (void)
24 fputs ("UBSAN TEST START\n", stderr);
26 foo (3, 2);
27 bar (12, 42);
29 fputs ("UBSAN TEST END\n", stderr);
30 return 0;
33 /* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */