harec

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

commit a1eb2b4e7fd6f919bcbeac44c81742123a9d0206
parent 9c2ad2b58a6cdb6012fb559a90a45c681390e85a
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 13 Feb 2021 11:50:11 -0500

gen: fix cast from tagged to aggregate

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

diff --git a/src/gen.c b/src/gen.c @@ -1182,10 +1182,14 @@ gen_cast_from_tagged(struct gen_context *ctx, ptr.type = qtype_for_type(ctx, expr->result, false); qval_deref(&ptr); if (object.indirect) { - gen_loadtemp(ctx, &temp, &ptr, - qtype_for_type(ctx, expr->result, false), - type_is_signed(expr->result)); - gen_store(ctx, out, &temp); + if (!type_is_aggregate(expr->result)) { + gen_loadtemp(ctx, &temp, &ptr, + qtype_for_type(ctx, expr->result, false), + type_is_signed(expr->result)); + gen_store(ctx, out, &temp); + } else { + gen_copy(ctx, out, &ptr); + } } else { gen_store(ctx, out, &ptr); }