aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/musttail32.c
blob: f1b7052fe906cc405a57a9938c98f621aff18d91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* PR ipa/121023 */
/* { dg-do compile { target musttail } } */
/* { dg-options "-O2" } */

struct S { int a, b; };

[[gnu::noipa]] int
foo (struct S x, int y, int z)
{
  return x.a + y + z;
}

[[gnu::noinline]] static int
bar (struct S x, int y, int z)
{
  [[gnu::musttail]] return foo ((struct S) { x.a, 0 }, y, 1);
}

int
baz (int x)
{
  return bar ((struct S) { 1, 2 }, x, 2) + bar ((struct S) { 2, 3 }, x + 1, 2);
}