struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug1714204.c
blobdab02dcc9b0b31fc1ddeb6cd47ead8b355739169
1 /*
2 bug 1714204
3 */
5 #include <testfwk.h>
7 typedef struct {
8 unsigned int w[2];
9 } TEST_TYPE;
11 unsigned char i1, i2, i3;
13 void foo(TEST_TYPE *p1, TEST_TYPE *p2, TEST_TYPE *p3)
15 if (p2->w[i2] > ++p3->w[i3])
16 p1->w[i1] = p2->w[i2] + p3->w[i3];
19 void
20 testBug(void)
22 TEST_TYPE t1 = { { 1, 1 } };
23 TEST_TYPE t2 = { { 1, 1 } };
24 TEST_TYPE t3 = { { 1, 1 } };
26 i1 = i2 = i3 = 0;
28 foo(&t1, &t2, &t3);
30 ASSERT (t1.w[0] == 1);