Debian Codegraph @

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

raw
1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=bounds" } */
3
4 struct S
5 {
6 unsigned long a[1];
7 int l;
8 };
9
10 static inline unsigned long
11 fn (const struct S *s, int i)
12 {
13 return s->a[i] << i;
14 }
15
16 int
17 main ()
18 {
19 struct S s;
20 fn (&s, 1);
21 }
22
23 /* { dg-output "index 1 out of bounds for type 'long unsigned int \\\[1\\\]'" } */