Debian Codegraph @

gcc/testsuite/c-c++-common/musttail2.c

raw
1 /* { dg-do compile { target { musttail && { c || c++11 } } } } */
2
3 struct box { char field[256]; int i; };
4
5 int __attribute__((noinline,noclone,noipa))
6 test_2_callee (int i, struct box b)
7 {
8 if (b.field[0])
9 return 5;
10 return i * i;
11 }
12
13 int __attribute__((noinline,noclone,noipa))
14 test_2_caller (int i)
15 {
16 struct box b;
17 [[gnu::musttail]] return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */
18 }
19
20 extern void setjmp (void);
21 void
22 test_3 (void)
23 {
24 [[gnu::musttail]] return setjmp (); /* { dg-error "cannot tail-call: " } */
25 }
26
27 extern float f7(void);
28
29 int
30 test_6 (void)
31 {
32 [[gnu::musttail]] return f7(); /* { dg-error "cannot tail-call: " } */
33 }