harec

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

commit 03979e833ccff6a255346394668e695cb0b40c78
parent 2adf5ca288595d9fdd6111ff90293d362b0d92ac
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri,  5 Feb 2021 16:19:03 -0500

gen: fix issues with type testing

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

diff --git a/src/gen.c b/src/gen.c @@ -399,6 +399,7 @@ address_field(struct gen_context *ctx, struct qbe_value offset = {0}; constl(&offset, field->offset); pushi(ctx->current, out, Q_ADD, out, &offset, NULL); + out->type = qtype_for_type(ctx, field->type, false); if (!type_is_aggregate(field->type)) { qval_deref(out); } @@ -1061,7 +1062,7 @@ gen_expr_type_test(struct gen_context *ctx, *tagged = type_dealias(expr->cast.value->result); struct qbe_value tag = {0}, in = {0}, id = {0}; gen_temp(ctx, &tag, &qbe_word, "tag.%d"); - gen_temp(ctx, &in, qtype_for_type(ctx, tagged, false), "cast.in.%d"); + alloc_temp(ctx, &in, tagged, "cast.in.%d"); qval_address(&in); gen_expression(ctx, expr->cast.value, &in); pushi(ctx->current, &tag, Q_LOADUW, &in, NULL);