struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug3559997.c
blob56351715e762000fc0df32793a5bcde12653234f
1 /*
2 bug3559997.c
3 */
5 #include <testfwk.h>
7 #pragma disable_warning 85
9 typedef struct
11 long i_size;
12 } s1_t;
14 typedef struct {
15 s1_t s;
16 } i_t, *ip_t;
18 typedef struct
20 char *m3;
21 long m4;
22 } data_t;
24 data_t data;
26 void f1(char *a, char *p, int b)
30 char *f2(int a, int b, char c)
32 return(0);
35 int f3(char *p, int c)
37 return(1);
40 void rx(ip_t i)
42 char *bp = 0;
43 int dev = 0;
46 bp = f2(dev, 0, 1);
47 f1(data.m3, bp, 1);
48 if (f3(bp, 2) < 0)
49 return;
50 if (data.m4 > i->s.i_size)
51 i->s.i_size = data.m4;
55 void testBug(void)
57 i_t i;
58 data.m4 = 0xaa55;
59 i.s.i_size = 0x55aa;
60 rx(&i);
61 ASSERT(i.s.i_size == 0xaa55);