libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / plugin / must-tail-call-2.c
blobd51d15cc087978762d42058a2bd96dc5dcd94882
1 /* { dg-do compile { target tail_call } } */
2 /* Allow nested functions. */
3 /* { dg-options "-Wno-pedantic" } */
5 struct box { char field[64]; int i; };
7 struct box __attribute__((noinline,noclone))
8 returns_struct (int i)
10 struct box b;
11 b.i = i * i;
12 return b;
15 int __attribute__((noinline,noclone))
16 test_1 (int i)
18 return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: " } */
21 int __attribute__((noinline,noclone))
22 test_2_callee (int i, struct box b)
24 if (b.field[0])
25 return 5;
26 return i * i;
29 int __attribute__((noinline,noclone))
30 test_2_caller (int i)
32 struct box b;
33 return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */
36 extern void setjmp (void);
37 void
38 test_3 (void)
40 setjmp (); /* { dg-error "cannot tail-call: " } */
43 void
44 test_4 (void)
46 void nested (void)
49 nested (); /* { dg-error "cannot tail-call: " } */
52 typedef void (fn_ptr_t) (void);
53 volatile fn_ptr_t fn_ptr;
55 void
56 test_5 (void)
58 fn_ptr (); /* { dg-error "cannot tail-call: " } */