Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020129-1.c
blob9b41bc03fa6a16998f9b00a596a12d108d0d6e1c
1 /*
2 20020129-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 /* This testcase failed at -O2 on IA-64, because scheduling did not take
12 into account conditional execution when using cselib for alias
13 analysis. */
15 struct D { int d1; struct D *d2; };
16 struct C { struct D c1; long c2, c3, c4, c5, c6; };
17 struct A { struct A *a1; struct C *a2; };
18 struct B { struct C b1; struct A *b2; };
20 #ifndef __SDCC_pdk14 // Lack of memory
21 void
22 foo (struct B *x, struct B *y)
24 if (x->b2 == 0)
26 struct A *a;
28 x->b2 = a = y->b2;
29 y->b2 = 0;
30 for (; a; a = a->a1)
31 a->a2 = &x->b1;
34 if (y->b2 != 0)
35 ASSERT (0);
37 if (x->b1.c3 == -1)
39 x->b1.c3 = y->b1.c3;
40 x->b1.c4 = y->b1.c4;
41 y->b1.c3 = -1;
42 y->b1.c4 = 0;
45 if (y->b1.c3 != -1)
46 ASSERT (0);
49 struct B x, y;
50 #endif
52 void
53 testTortureExecute (void)
55 #ifndef __SDCC_pdk14 // Lack of memory
56 y.b1.c1.d1 = 6;
57 y.b1.c3 = 145;
58 y.b1.c4 = 2448;
59 x.b1.c3 = -1;
60 foo (&x, &y);
61 #endif