| 1 |
/* PR sanitizer/112709 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-fsanitize=undefined -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 |
} |
| 51 |
|
| 52 |
void |
| 53 |
freddy (int x, int *y, struct S *p) |
| 54 |
{ |
| 55 |
bar (*p); |
| 56 |
++p; |
| 57 |
if (x == 25) |
| 58 |
x = foo (2); |
| 59 |
else if (x == 42) |
| 60 |
x = foo (foo (3)); |
| 61 |
*y = bar (*p); |
| 62 |
} |