| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O3 -fno-early-inlining" } */ |
| 3 |
|
| 4 |
int array[128]; |
| 5 |
|
| 6 |
volatile int v = 0; |
| 7 |
volatile int blah = 0; |
| 8 |
|
| 9 |
int __attribute__((noipa)) |
| 10 |
obscured_zero () |
| 11 |
{ |
| 12 |
return 0; |
| 13 |
} |
| 14 |
|
| 15 |
int __attribute__((noipa)) |
| 16 |
obscured_one () |
| 17 |
{ |
| 18 |
return 1; |
| 19 |
} |
| 20 |
|
| 21 |
int __attribute__((noipa)) |
| 22 |
obscured_two () |
| 23 |
{ |
| 24 |
return 2; |
| 25 |
} |
| 26 |
|
| 27 |
static |
| 28 |
void cb1 (int l) |
| 29 |
{ |
| 30 |
v = 25; |
| 31 |
} |
| 32 |
|
| 33 |
static |
| 34 |
void cb2 (int l) |
| 35 |
{ |
| 36 |
v = 125; |
| 37 |
} |
| 38 |
|
| 39 |
typedef void (*silly_callback)(int); |
| 40 |
|
| 41 |
silly_callback __attribute__((noipa)) |
| 42 |
get_callback () |
| 43 |
{ |
| 44 |
return cb1; |
| 45 |
} |
| 46 |
|
| 47 |
static void |
| 48 |
f (int c, int l, silly_callback p) |
| 49 |
{ |
| 50 |
int i; |
| 51 |
|
| 52 |
for (i = 0; i < c; i++) |
| 53 |
array[i] = 455; |
| 54 |
|
| 55 |
for (i = 0; i < 200; i++) |
| 56 |
{ |
| 57 |
p (l); |
| 58 |
if (obscured_one ()) |
| 59 |
break; |
| 60 |
} |
| 61 |
|
| 62 |
if (l > 0) |
| 63 |
f (c * 2, l - 1, p); |
| 64 |
blah = l; |
| 65 |
} |
| 66 |
|
| 67 |
int |
| 68 |
main (int argc, char *argv[]) |
| 69 |
{ |
| 70 |
int i; |
| 71 |
for (i = 0; i < 1000; i++) |
| 72 |
{ |
| 73 |
f (0, 5, get_callback ()); |
| 74 |
if (v != 25) |
| 75 |
__builtin_abort (); |
| 76 |
if (obscured_one ()) |
| 77 |
break; |
| 78 |
} |
| 79 |
|
| 80 |
for (i = 0; i < 1000; i++) |
| 81 |
{ |
| 82 |
f (obscured_zero (), obscured_two (), cb2); |
| 83 |
if (v != 125) |
| 84 |
__builtin_abort (); |
| 85 |
if (obscured_one ()) |
| 86 |
break; |
| 87 |
} |
| 88 |
|
| 89 |
return 0; |
| 90 |
} |