gcc/testsuite/c-c++-common/ubsan/const-expr-1.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fsanitize=shift -w" } */ |
| 3 | |
| 4 | enum e { A = 1 << 1, B, }; |
| 5 | const int arr[] = { |
| 6 | 1 << 2, |
| 7 | 1 << 3, |
| 8 | }; |
| 9 | |
| 10 | int |
| 11 | bar (int a, int b) |
| 12 | { |
| 13 | return a >> b; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | foo (void) |
| 18 | { |
| 19 | int i = 1; |
| 20 | int vla[B << 3]; |
| 21 | return bar (A, (i <<= 6, i + 2)); |
| 22 | } |