Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/bounds-19.c

raw
1 /* PR sanitizer/108060 */
2 /* { dg-do run } */
3 /* { dg-options "-fsanitize=bounds" } */
4 /* { dg-skip-if "" { *-*-* } "-flto" } */
5 /* { dg-shouldfail "ubsan" } */
6
7 int a[8];
8 int a2[18];
9 int c;
10
11 int
12 main ()
13 {
14 int b = 0;
15 a[0] = (a2[b], b = -32768, a[0] | c);
16 b = 0;
17 a[b] = (a[b], b = -32768, a[0] | c);
18 }
19
20 /* { dg-output "index -32768 out of bounds for type 'int \\\[8\\\]'" } */