[qfcc] Apply member alignment to union size

Seeing a union of size 7 when its members need an alignment of 4 was
rather a concern.
This commit is contained in:
Bill Currie 2023-08-29 08:25:19 +09:00
parent e4391992cb
commit ad6b4057f9
1 changed files with 3 additions and 2 deletions

View File

@ -175,8 +175,9 @@ build_struct (int su, symbol_t *tag, symtab_t *symtab, type_t *type, int base)
symtab->size += type_size (s->type);
} else {
int size = type_size (s->type);
if (size > symtab->size)
symtab->size = size;
if (size > symtab->size) {
symtab->size = RUP (size, s->type->alignment);
}
}
if (s->type->alignment > alignment) {
alignment = s->type->alignment;