Debian Codegraph @

gcc/testsuite/g++.dg/ubsan/pr105729.C

raw
1 // PR sanitizer/105729
2 // { dg-do run }
3 // { dg-options "-fsanitize=null -fno-sanitize-recover=null" }
4
5 int
6 foo (int x)
7 {
8 throw 0;
9 }
10
11 struct S {};
12 struct T {
13 S *data;
14 T () : data (0) {}
15 const S &bar (int x) const { return data[foo (x)]; }
16 };
17
18 int
19 main ()
20 {
21 T t;
22 try
23 {
24 t.bar (-1);
25 }
26 catch (...)
27 {
28 }
29 }