struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20010118-1.c
blob296ce5aed7aa47820819c1f3e056c18dc7644129
1 /*
2 20010118-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 85
10 #pragma disable_warning 93
11 #endif
13 typedef struct {
14 int a, b, c, d, e, f;
15 } A;
17 void foo (A *v, int w, int x, int *y, int *z)
21 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
22 void
23 bar (A *v, int x, int y, int w, int h)
25 if (v->a != x || v->b != y) {
26 int oldw = w;
27 int oldh = h;
28 int e = v->e;
29 int f = v->f;
30 int dx, dy;
31 foo(v, 0, 0, &w, &h);
32 dx = (oldw - w) * (double) e/2.0;
33 dy = (oldh - h) * (double) f/2.0;
34 x += dx;
35 y += dy;
36 v->a = x;
37 v->b = y;
38 v->c = w;
39 v->d = h;
42 #endif
44 void
45 testTortureExecute (void)
47 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
48 A w = { 100, 110, 20, 30, -1, -1 };
49 bar (&w,400,420,50,70);
50 if (w.d != 70)
51 ASSERT(0);
52 return;
53 #endif