harec

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

commit 3fdbcbb3c04f151e3878e73494f455f8a68f540d
parent 0d8fc810973a8a9e4e57f99644c0a2713ac1e671
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 31 Jan 2021 12:11:32 -0500

gen: use appropriate type for struct fields

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

diff --git a/src/gen.c b/src/gen.c @@ -1849,7 +1849,10 @@ gen_expr_struct(struct gen_context *ctx, const struct expression_struct *field = &expr->_struct; while (field) { constl(&offset, field->field->offset); + ptr.type = &qbe_long; pushi(ctx->current, &ptr, Q_ADD, &base, &offset, NULL); + + ptr.type = qtype_for_type(ctx, field->field->type, true); ptr.indirect = !type_is_aggregate(field->field->type); gen_expression(ctx, field->value, &ptr); field = field->next;