Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/vptr-14.C

raw
1 // PR sanitizer/89869
2 // { dg-do run { target c++11 } }
3 // { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" }
4
5 struct S { S *s = 0; virtual ~S () {} };
6
7 void
8 foo (S *x, S *y)
9 {
10 (x->s ? y : x) = x->s;
11 }
12
13 int
14 main ()
15 {
16 S a;
17 foo (&a, 0);
18 }