gcc/testsuite/c-c++-common/musttail32.c
raw| 1 | /* PR ipa/121023 */ |
| 2 | /* { dg-do compile { target musttail } } */ |
| 3 | /* { dg-options "-O2" } */ |
| 4 | |
| 5 | struct S { int a, b; }; |
| 6 | |
| 7 | [[gnu::noipa]] int |
| 8 | foo (struct S x, int y, int z) |
| 9 | { |
| 10 | return x.a + y + z; |
| 11 | } |
| 12 | |
| 13 | [[gnu::noinline]] static int |
| 14 | bar (struct S x, int y, int z) |
| 15 | { |
| 16 | [[gnu::musttail]] return foo ((struct S) { x.a, 0 }, y, 1); |
| 17 | } |
| 18 | |
| 19 | int |
| 20 | baz (int x) |
| 21 | { |
| 22 | return bar ((struct S) { 1, 2 }, x, 2) + bar ((struct S) { 2, 3 }, x + 1, 2); |
| 23 | } |