struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050713-1.c
blob2f56867274174b7eb81dbe9f2dd8d615486c61f7
1 /*
2 20050713-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* Test that sibling call is not used if there is an argument overlap. */
13 struct S
15 int a, b, c;
18 #ifndef __SDCC_pdk14 // Lack of memory
19 int
20 foo2 (struct S x, struct S y)
22 if (x.a != 3 || x.b != 4 || x.c != 5)
23 ASSERT (0);
24 if (y.a != 6 || y.b != 7 || y.c != 8)
25 ASSERT (0);
26 return 0;
29 int
30 foo3 (struct S x, struct S y, struct S z)
32 foo2 (x, y);
33 if (z.a != 9 || z.b != 10 || z.c != 11)
34 ASSERT (0);
35 return 0;
38 int
39 bar2 (struct S x, struct S y)
41 return foo2 (y, x);
44 int
45 bar3 (struct S x, struct S y, struct S z)
47 return foo3 (y, x, z);
50 int
51 baz3 (struct S x, struct S y, struct S z)
53 return foo3 (y, z, x);
55 #endif
57 void
58 testTortureExecute (void)
60 #ifndef __SDCC_pdk14 // Lack of memory
61 struct S a = { 3, 4, 5 }, b = { 6, 7, 8 }, c = { 9, 10, 11 };
63 bar2 (b, a);
64 bar3 (b, a, c);
65 baz3 (c, a, b);
66 return;
67 #endif