aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rwxr-xr-xtccgen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tccgen.c b/tccgen.c
index a240937..900c775 100755
--- a/tccgen.c
+++ b/tccgen.c
@@ -4865,6 +4865,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
index = 0;
n = s->c;
while (tok != '}') {
+ int bit_pos;
decl_designator(type, sec, c, NULL, &f, size_only);
index = f->c;
if (!size_only && array_length < index) {
@@ -4876,8 +4877,13 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
array_length = index;
/* Coo: skip fields from same union */
- while (f->next && f->next->c<index)
- f=f->next;
+ if ((f->type.t&VT_BITFIELD)==0)
+ bit_pos=index*8;
+ else
+ bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f);
+ while (f->next && f->next->c<index &&
+ ((f->next->type.t&VT_BITFIELD)==0 || f->next->c*8+((f->next->type.t>>VT_STRUCT_SHIFT)&0x3f)<bit_pos))
+ f=f->next;
f = f->next;
if (no_oblock && f == NULL)