| 1 |
/* PR tree-optimization/89060 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-tailc" } */ |
| 4 |
/* { dg-final { scan-tree-dump-not "baz \\\(1\\\); \\\[tail call\\\]" "tailc" } } */ |
| 5 |
/* { dg-final { scan-tree-dump "baz \\\(2\\\); \\\[tail call\\\]" "tailc" } } */ |
| 6 |
/* { dg-final { scan-tree-dump "baz \\\(3\\\); \\\[tail call\\\]" "tailc" } } */ |
| 7 |
/* { dg-final { scan-tree-dump "baz \\\(4\\\); \\\[tail call\\\]" "tailc" } } */ |
| 8 |
/* { dg-final { scan-tree-dump-not "baz \\\(5\\\); \\\[tail call\\\]" "tailc" } } */ |
| 9 |
|
| 10 |
void qux (char *, int n); |
| 11 |
int baz (int); |
| 12 |
|
| 13 |
int |
| 14 |
foo (int n) |
| 15 |
{ |
| 16 |
char buf[64]; |
| 17 |
qux (buf, n); |
| 18 |
return baz (1); |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
bar (int n) |
| 23 |
{ |
| 24 |
{ |
| 25 |
char buf[64]; |
| 26 |
qux (buf, n); |
| 27 |
} |
| 28 |
return baz (2); |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
quux (int n) |
| 33 |
{ |
| 34 |
if (n < 10) |
| 35 |
{ |
| 36 |
{ |
| 37 |
char buf[64]; |
| 38 |
qux (buf, n); |
| 39 |
} |
| 40 |
return baz (3); |
| 41 |
} |
| 42 |
if (n > 20) |
| 43 |
{ |
| 44 |
{ |
| 45 |
char buf2[64]; |
| 46 |
qux (buf2, n + 1); |
| 47 |
} |
| 48 |
return baz (4); |
| 49 |
} |
| 50 |
char buf3[64]; |
| 51 |
qux (buf3, n + 2); |
| 52 |
return baz (5); |
| 53 |
} |