aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/pr65984.c
blob: 94ba0110b0b2e6e07ab2342c30fa75e2ac56be52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* PR tree-optimization/65984 */
/* { dg-do compile } */
/* { dg-options "-fnon-call-exceptions -fsanitize=bool,enum" } */

#ifndef __cplusplus
#define bool _Bool
#endif

enum E { E0, E1, E2 };
enum E e[2];
bool *b;

int
foo (int i)
{
  return e[i];
}

int
bar (int i)
{
  return b[i];
}