commit d72310bf87436aec5a9f2008d6ab8d9f7884ce79
parent 0334cdb175e881bdb56bf2b151d7ab92e2e7651a
Author: Drew DeVault <sir@cmpwn.com>
Date: Thu, 5 Aug 2021 11:11:25 +0200
gen: update value type in cast early return
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/gen.c b/src/gen.c
@@ -404,7 +404,9 @@ gen_expr_cast(struct gen_context *ctx, const struct expression *expr)
if (type_dealias(to)->storage == type_dealias(from)->storage
&& to->size == from->size) {
- return gen_expr(ctx, expr->cast.value);
+ struct gen_value value = gen_expr(ctx, expr->cast.value);
+ value.type = to;
+ return value;
}
// Special cases