harec

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

commit d130aed8fc7654271e1478e7085136fb8074c004
parent 6a7e41acb0ba1eed37d06f6fe601cec20535db6c
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 22 Aug 2021 15:31:17 +0200

gen: support tagged data of size zero

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Msrc/gen.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -3038,9 +3038,11 @@ gen_data_item(struct gen_context *ctx, struct expression *expr, case STORAGE_TAGGED: item->type = QD_VALUE; item->value = constw((uint32_t)constant->tagged.tag->id); - item->next = xcalloc(1, sizeof(struct qbe_data_item)); - item = item->next; - gen_data_item(ctx, constant->tagged.value, item); + if (constant->tagged.tag->size != 0) { + item->next = xcalloc(1, sizeof(struct qbe_data_item)); + item = item->next; + gen_data_item(ctx, constant->tagged.value, item); + } break; case STORAGE_UNION: assert(0); // TODO