gcc/testsuite/c-c++-common/pr119614-3.c
raw| 1 | /* PR tree-optimization/119614 */ |
| 2 | /* { dg-do compile { target musttail } } */ |
| 3 | /* { dg-options "-O2" } */ |
| 4 | |
| 5 | volatile int v; |
| 6 | |
| 7 | [[gnu::noinline]] double |
| 8 | foo (int x) |
| 9 | { |
| 10 | v += x; |
| 11 | return 0.5; |
| 12 | } |
| 13 | |
| 14 | double |
| 15 | bar (int x) |
| 16 | { |
| 17 | if (x == 42) |
| 18 | [[gnu::musttail]] return foo (42); |
| 19 | [[gnu::musttail]] return foo (32); |
| 20 | } |
| 21 | |
| 22 | double |
| 23 | baz (int x) |
| 24 | { |
| 25 | if (x == 5) |
| 26 | return foo (42); |
| 27 | return foo (32); |
| 28 | } |