Unified · Split
| @@ -2764,6 +2764,7 @@ static void struct_decl(CType *type, int u) · 2763 unmodified lines | |||
| 2764 | v = anon_sym++; | 2764 | v = anon_sym++; |
| 2765 | } | 2765 | } |
| 2766 | type1.t = a; | 2766 | type1.t = a; |
| 2767 | type1.ref = NULL; | ||
| 2767 | /* we put an undefined size for struct/union */ | 2768 | /* we put an undefined size for struct/union */ |
| 2768 | s = sym_push(v | SYM_STRUCT, &type1, 0, -1); | 2769 | s = sym_push(v | SYM_STRUCT, &type1, 0, -1); |
| 2769 | s->r = 0; /* default alignment is zero as gcc */ | 2770 | s->r = 0; /* default alignment is zero as gcc */ |
| @@ -5337,12 +5338,13 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 2567 unmodified lines | |||
| 5337 | 5338 | ||
| 5338 | flexible_array = NULL; | 5339 | flexible_array = NULL; |
| 5339 | if ((type->t & VT_BTYPE) == VT_STRUCT) { | 5340 | if ((type->t & VT_BTYPE) == VT_STRUCT) { |
| 5340 | Sym *field; | 5341 | Sym *field = type->ref->next; |
| 5341 | field = type->ref; | 5342 | if (field) { |
| 5342 | while (field && field->next) | 5343 | while (field->next) |
| 5343 | field = field->next; | 5344 | field = field->next; |
| 5344 | if (field->type.t & VT_ARRAY && field->type.ref->c < 0) | 5345 | if (field->type.t & VT_ARRAY && field->type.ref->c < 0) |
| 5345 | flexible_array = field; | 5346 | flexible_array = field; |
| 5347 | } | ||
| 5346 | } | 5348 | } |
| 5347 | 5349 | ||
| 5348 | size = type_size(type, &align); | 5350 | size = type_size(type, &align); |