Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / tailcall-7.c
blobdef8d137f7c4ed32ce7757d3fe881b34512c9cd7
1 /* { dg-do compile { target trampolines } } */
2 /* { dg-options "-O2 -fdump-tree-tailc-details" } */
4 struct s { int x; };
5 struct s f (int);
6 struct s global;
7 void callit (void (*) (void));
9 /* Tail call. */
10 void
11 g1 (void)
13 f (1);
16 /* Not a tail call. */
17 void
18 g2 (void)
20 global = f (2);
23 /* Not a tail call. */
24 void
25 g3 (struct s *ptr)
27 *ptr = f (3);
30 /* Tail call. */
31 struct s
32 g4 (struct s param)
34 param = f (4);
35 return param;
38 /* Tail call. */
39 struct s
40 g5 (void)
42 struct s local = f (5);
43 return local;
46 /* Tail call. */
47 struct s
48 g6 (void)
50 return f (6);
53 /* Not a tail call. */
54 struct s
55 g7 (void)
57 struct s local = f (7);
58 global = local;
59 return local;
62 /* Not a tail call. */
63 struct s
64 g8 (struct s *ptr)
66 struct s local = f (8);
67 *ptr = local;
68 return local;
71 /* Not a tail call. */
72 int
73 g9 (struct s param)
75 void inner (void) { param = f (9); }
76 callit (inner);
77 return 9;
80 /* Tail call. */
81 int
82 g10 (int param)
84 void inner (void) { f (param); }
85 callit (inner);
86 return 10;
89 /* { dg-final { scan-tree-dump-times "Found tail call" 5 "tailc" } } */