aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/bounds-19.c
blob: 54217ae399f40fa86241444d8067eeadf4b024e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* PR sanitizer/108060 */
/* { dg-do run } */
/* { dg-options "-fsanitize=bounds" } */
/* { dg-skip-if "" { *-*-* } "-flto" } */
/* { dg-shouldfail "ubsan" } */

int a[8];
int a2[18];
int c;

int
main ()
{
  int b = 0;
  a[0] = (a2[b], b = -32768, a[0] | c);
  b = 0;
  a[b] = (a[b], b = -32768, a[0] | c);
}

/* { dg-output "index -32768 out of bounds for type 'int \\\[8\\\]'" } */