commit 833f2305adc84fd7c68efbf351ccbd23fad38766
parent 787ef05e155dc59a116c79d3817e55857974e2d4
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 23 Aug 2021 10:46:12 +0200
gen: insert trailing padding in tagged data items
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/gen.c b/src/gen.c
@@ -3049,6 +3049,12 @@ gen_data_item(struct gen_context *ctx, struct expression *expr,
item = item->next;
gen_data_item(ctx, constant->tagged.value, item);
}
+ if (constant->tagged.tag->size < type->size - type->align) {
+ item->next = xcalloc(1, sizeof(struct qbe_data_item));
+ item = item->next;
+ item->type = QD_ZEROED;
+ item->zeroed = type->size - type->align - constant->tagged.tag->size;
+ }
break;
case STORAGE_UNION:
assert(0); // TODO