Debian Codegraph @

gcc/testsuite/c-c++-common/ubsan/pr65081.c

raw
1 /* PR sanitizer/65081 */
2 /* { dg-do run } */
3 /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
4 /* { dg-options "-fsanitize=object-size -fno-sanitize-recover=object-size" } */
5
6 struct S
7 {
8 int a;
9 char p[1];
10 };
11
12 struct S b;
13
14 struct S *
15 foo ()
16 {
17 struct S *i = &b;
18 return i + 1;
19 }
20
21 int
22 main (void)
23 {
24 struct S *i = foo () - 1;
25 i->a = 1;
26 }