aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/musttail16.c
blob: f27a279233146920e84ad7b32295d21a8bf3d052 (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
30
31
32
33
/* { dg-do compile { target musttail } } */

struct box { char field[256]; int i; };

int __attribute__((noinline,noclone,noipa))
test_2_callee (int i, struct box b)
{
  if (b.field[0])
    return 5;
  return i * i;
}

int __attribute__((noinline,noclone,noipa))
test_2_caller (int i)
{
  struct box b;
  __attribute__((musttail)) return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */
}

extern void setjmp (void);
void
test_3 (void)
{
  __attribute__((musttail)) return setjmp (); /* { dg-error "cannot tail-call: " } */
}

extern float f7(void);

int
test_6 (void)
{
  __attribute__((musttail)) return f7(); /* { dg-error "cannot tail-call: " } */
}