PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / tailcall-8-run.c
blobf8929093846002dde1bdf96a09d2ca6411dda9c6
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-sources "tailcall-8.c" } */
5 struct s { int x; };
7 int expected;
8 struct s *last_ptr;
9 struct s tmp;
11 void
12 start (int val, struct s *initial_last_ptr)
14 expected = val;
15 tmp.x = val;
16 last_ptr = initial_last_ptr;
19 void
20 f_direct (struct s param)
22 if (param.x != expected)
23 __builtin_abort ();
26 void
27 f_indirect (struct s *ptr)
29 if (ptr->x != expected)
30 __builtin_abort ();
31 last_ptr = ptr;
32 ptr->x += 100;
35 void
36 f_void (void)
38 if (last_ptr->x != expected + 100)
39 __builtin_abort ();
43 void g1 (struct s);
44 void g2 (struct s *);
45 void g3 (struct s *);
46 void g4 (struct s *);
47 void g5 (struct s);
48 void g6 (struct s);
49 void g7 (struct s);
50 void g8 (struct s *);
51 void g9 (struct s *);
53 int
54 main (void)
56 struct s g6_s = { 106 };
58 start (1, 0);
59 g1 (tmp);
61 start (2, 0);
62 g2 (&tmp);
64 start (3, 0);
65 g3 (&tmp);
67 start (4, 0);
68 g4 (&tmp);
70 start (5, 0);
71 g5 (tmp);
73 start (6, &g6_s);
74 g6 (tmp);
76 start (7, 0);
77 g7 (tmp);
79 start (8, 0);
80 g8 (&tmp);
82 start (9, 0);
83 g9 (&tmp);
85 return 0;