harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6b8611115c60b6526d4c6958328b2e03ae96247a
parent bb8e071af8af1511a03769d944ffb2e4a91db3d0
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon,  1 Feb 2021 16:08:15 -0500

gen: insert struct padding into globals

Diffstat:
Msrc/gen.c | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -2298,6 +2298,17 @@ gen_data_item(struct gen_context *ctx, struct expression *expr, f; f = f->next) { gen_data_item(ctx, f->value, item); if (f->next) { + const struct struct_field *f1 = f->field; + const struct struct_field *f2 = f->next->field; + if (f2->offset != f1->offset + f2->type->size) { + item->next = xcalloc(1, + sizeof(struct qbe_data_item)); + item = item->next; + item->type = QD_ZEROED; + item->zeroed = f2->offset - + (f1->offset + f1->type->size); + } + item->next = xcalloc(1, sizeof(struct qbe_data_item)); item = item->next;