gcc/testsuite/c-c++-common/ubsan/undefined-1.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */ |
| 3 | |
| 4 | int |
| 5 | foo (int x, int y) |
| 6 | { |
| 7 | const int z = 2; |
| 8 | if (z & 1) |
| 9 | return x << y; |
| 10 | return 0; |
| 11 | } |
| 12 | |
| 13 | int |
| 14 | bar (int x, int y) |
| 15 | { |
| 16 | return x + y; |
| 17 | } |
| 18 | |
| 19 | int |
| 20 | main (void) |
| 21 | { |
| 22 | foo (3, 2); |
| 23 | bar (12, 42); |
| 24 | return 0; |
| 25 | } |