struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug1856409.c.in
blob0ff2dd54c46565db78c2edef0583d2e35e9eb5f2
1 /*
2 bug 1856409
3 storage: static __code,
4 */
6 #include <stdint.h>
7 #include <testfwk.h>
9 #ifndef PORT_HOST
10 #pragma disable_warning 158 //no warning about overflow in constant (W_LIT_OVERFLOW)
11 #endif
13 typedef struct {
14 unsigned int e:2;
15 unsigned int f:3;
16 unsigned int g:3;
17 } Ta;
19 void
20 testBug (void)
22 {storage} Ta aa = {1, 29, 0};
23 {storage} uint16_t xx = 100000;
24 char t;
26 t = aa.e;
27 ASSERT (t == (1 & 3));
28 t = aa.f;
29 ASSERT (t == (29 & 7));
30 t = aa.g;
31 ASSERT (t == (0 & 7));
33 ASSERT (xx == (uint16_t)(100000 & 65535));