gcc/testsuite/c-c++-common/ubsan/pr65984.c
raw| 1 | /* PR tree-optimization/65984 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-fnon-call-exceptions -fsanitize=bool,enum" } */ |
| 4 | |
| 5 | #ifndef __cplusplus |
| 6 | #define bool _Bool |
| 7 | #endif |
| 8 | |
| 9 | enum E { E0, E1, E2 }; |
| 10 | enum E e[2]; |
| 11 | bool *b; |
| 12 | |
| 13 | int |
| 14 | foo (int i) |
| 15 | { |
| 16 | return e[i]; |
| 17 | } |
| 18 | |
| 19 | int |
| 20 | bar (int i) |
| 21 | { |
| 22 | return b[i]; |
| 23 | } |