Imported Upstream version 2.9.0
[debian/cc1111] / support / regression / tests / bug1856409.c
1 /*
2     bug 1856409
3     storage: static code,
4 */
5
6 #include <stdint.h>
7 #include <testfwk.h>
8
9 #ifndef PORT_HOST
10 #pragma disable_warning 158 //no warning about overflow in constant (W_LIT_OVERFLOW)
11 #endif
12
13 typedef struct {
14         unsigned int e:2;
15         unsigned int f:3;
16         unsigned int g:3;
17 } Ta;
18
19 void
20 testBug(void)
21 {
22         {storage} Ta aa = {1, 29, 0};
23         {storage} uint16_t xx = 100000;
24         char t;
25
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));
32
33         ASSERT(xx == (uint16_t)(100000 & 65535));
34 }