OSDN Git Service

Backported from mainline
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 20050713-1.c
1 /* Test that sibling call is not used if there is an argument overlap.  */
2
3 extern void abort (void);
4
5 struct S
6 {
7   int a, b, c;
8 };
9
10 int
11 foo2 (struct S x, struct S y)
12 {
13   if (x.a != 3 || x.b != 4 || x.c != 5)
14     abort ();
15   if (y.a != 6 || y.b != 7 || y.c != 8)
16     abort ();
17   return 0;
18 }
19
20 int
21 foo3 (struct S x, struct S y, struct S z)
22 {
23   foo2 (x, y);
24   if (z.a != 9 || z.b != 10 || z.c != 11)
25     abort ();
26   return 0;
27 }
28
29 int
30 bar2 (struct S x, struct S y)
31 {
32   return foo2 (y, x);
33 }
34
35 int
36 bar3 (struct S x, struct S y, struct S z)
37 {
38   return foo3 (y, x, z);
39 }
40
41 int
42 baz3 (struct S x, struct S y, struct S z)
43 {
44   return foo3 (y, z, x);
45 }
46
47 int
48 main (void)
49 {
50   struct S a = { 3, 4, 5 }, b = { 6, 7, 8 }, c = { 9, 10, 11 };
51
52   bar2 (b, a);
53   bar3 (b, a, c);
54   baz3 (c, a, b);
55   return 0;
56 }