| 1 |
/* { dg-require-effective-target trampolines } */ |
| 2 |
|
| 3 |
void abort (void); |
| 4 |
void exit (int); |
| 5 |
|
| 6 |
extern int foo (int, int, int (*) (int, int, int, int, int, int, int)); |
| 7 |
|
| 8 |
int z; |
| 9 |
|
| 10 |
int |
| 11 |
main (void) |
| 12 |
{ |
| 13 |
int sum = 0; |
| 14 |
int i; |
| 15 |
|
| 16 |
int nested (int a, int b, int c, int d, int e, int f, int g) |
| 17 |
{ |
| 18 |
z = c + d + e + f + g; |
| 19 |
|
| 20 |
if (a > 2 * b) |
| 21 |
return a - b; |
| 22 |
else |
| 23 |
return b - a; |
| 24 |
} |
| 25 |
|
| 26 |
for (i = 0; i < 10; ++i) |
| 27 |
{ |
| 28 |
int j; |
| 29 |
|
| 30 |
for (j = 0; j < 10; ++j) |
| 31 |
{ |
| 32 |
int k; |
| 33 |
|
| 34 |
for (k = 0; k < 10; ++k) |
| 35 |
sum += foo (i, j > k ? j - k : k - j, nested); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if (sum != 2300) |
| 40 |
abort (); |
| 41 |
|
| 42 |
if (z != 0x1b) |
| 43 |
abort (); |
| 44 |
|
| 45 |
exit (0); |
| 46 |
} |
| 47 |
|
| 48 |
int |
| 49 |
foo (int a, int b, int (* fp) (int, int, int, int, int, int, int)) |
| 50 |
{ |
| 51 |
return fp (a, b, a, b, a, b, a); |
| 52 |
} |