struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr88714.c
blobf8152defead9baf60ca5eab11b3f07a1fa4d7915
1 /*
2 pr88693.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 /* PR bootstrap/88714 */
9 struct S { int a, b, c; int *d; };
10 struct T { int *e, *f, *g; } *t = 0;
11 int *o = 0;
13 void bar (int *x, int y, int z, int w)
15 if (w == -1)
17 if (x != 0 || y != 0 || z != 0)
18 ASSERT (0);
20 else if (w != 0 || x != t->g || y != 0 || z != 12)
21 ASSERT (0);
24 void
25 foo (struct S *x, struct S *y, int *z, int w)
27 *o = w;
28 if (w)
29 bar (0, 0, 0, -1);
30 x->d = z;
31 if (y->d)
32 y->c = y->c + y->d[0];
33 bar (t->g, 0, y->c, 0);
36 void
37 testTortureExecute (void)
39 #ifndef __SDCC_pdk14 // Lack of RAM
40 int a[4] = { 8, 9, 10, 11 };
41 struct S s = { 1, 2, 3, &a[0] };
42 struct T u = { 0, 0, &a[3] };
43 o = &a[2];
44 t = &u;
45 foo (&s, &s, &a[1], 5);
46 if (s.c != 12 || s.d != &a[1])
47 ASSERT (0);
48 return;
49 #endif