Unified · Split
| @@ -4865,6 +4865,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4864 unmodified lines | ||
| 4865 | 4865 | index = 0; |
| 4866 | 4866 | n = s->c; |
| 4867 | 4867 | while (tok != '}') { |
| 4868 | + int bit_pos; | |
| 4868 | 4869 | decl_designator(type, sec, c, NULL, &f, size_only); |
| 4869 | 4870 | index = f->c; |
| 4870 | 4871 | if (!size_only && array_length < index) { |
| @@ -4876,8 +4877,13 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 5 unmodified lines | ||
| 4876 | 4877 | array_length = index; |
| 4877 | 4878 | |
| 4878 | 4879 | /* Coo: skip fields from same union */ |
| 4879 | − while (f->next && f->next->c<index) | |
| 4880 | − f=f->next; | |
| 4880 | + if ((f->type.t&VT_BITFIELD)==0) | |
| 4881 | + bit_pos=index*8; | |
| 4882 | + else | |
| 4883 | + bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f); | |
| 4884 | + while (f->next && f->next->c<index && | |
| 4885 | + ((f->next->type.t&VT_BITFIELD)==0 || f->next->c*8+((f->next->type.t>>VT_STRUCT_SHIFT)&0x3f)<bit_pos)) | |
| 4886 | + f=f->next; | |
| 4881 | 4887 | |
| 4882 | 4888 | f = f->next; |
| 4883 | 4889 | if (no_oblock && f == NULL) |