Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / plugin / must-tail-call-2.c
blobc6dfecd32458519879c7348c5f0740f915cd3fab
1 /* Allow nested functions. */
2 /* { dg-options "-Wno-pedantic" } */
4 struct box { char field[64]; int i; };
6 struct box __attribute__((noinline,noclone))
7 returns_struct (int i)
9 struct box b;
10 b.i = i * i;
11 return b;
14 int __attribute__((noinline,noclone))
15 test_1 (int i)
17 return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: " } */
20 int __attribute__((noinline,noclone))
21 test_2_callee (int i, struct box b)
23 if (b.field[0])
24 return 5;
25 return i * i;
28 int __attribute__((noinline,noclone))
29 test_2_caller (int i)
31 struct box b;
32 return test_2_callee (i + 1, b); /* { dg-error "cannot tail-call: " } */
35 extern void setjmp (void);
36 void
37 test_3 (void)
39 setjmp (); /* { dg-error "cannot tail-call: " } */
42 void
43 test_4 (void)
45 void nested (void)
48 nested (); /* { dg-error "cannot tail-call: " } */
51 typedef void (fn_ptr_t) (void);
52 volatile fn_ptr_t fn_ptr;
54 void
55 test_5 (void)
57 fn_ptr (); /* { dg-error "cannot tail-call: " } */