]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/asan/pr112709-2.c
asan: Fix ICE during instrumentation of returns_twice calls [PR112709]
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / asan / pr112709-2.c
1 /* PR sanitizer/112709 */
2 /* { dg-do compile } */
3 /* { dg-options "-fsanitize=address -O2" } */
4
5 struct S { char c[1024]; } *p;
6 int foo (int);
7
8 __attribute__((returns_twice, noipa)) int
9 bar (struct S x)
10 {
11 (void) x.c[0];
12 return 0;
13 }
14
15 void
16 baz (int *y)
17 {
18 foo (1);
19 *y = bar (*p);
20 }
21
22 void
23 qux (int x, int *y)
24 {
25 if (x == 25)
26 x = foo (2);
27 else if (x == 42)
28 x = foo (foo (3));
29 *y = bar (*p);
30 }
31
32 void
33 corge (int x, int *y)
34 {
35 void *q[] = { &&l1, &&l2, &&l3, &&l3 };
36 if (x == 25)
37 {
38 l1:
39 x = foo (2);
40 }
41 else if (x == 42)
42 {
43 l2:
44 x = foo (foo (3));
45 }
46 l3:
47 *y = bar (*p);
48 if (x < 4)
49 goto *q[x & 3];
50 }