aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr119483-1.c
blob: b2d7b57795a596635df49307f8776d589aa2959d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* PR tree-optimization/119483 */
/* { dg-do compile { target musttail } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times "baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */

[[gnu::noreturn]] extern void foo (void);

[[gnu::noinline]] static int
bar (int x)
{
  (void) x;
  foo ();
  return 0;
}

[[gnu::noipa]] int
baz (int x)
{
  return x + 42;
}

int
qux (int x)
{
  if (x == 1)
    [[gnu::musttail]] return bar (1);
  [[gnu::musttail]] return baz (x);
}