harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit 05b599b8e6fbabb1fed2562989af9564f8fbff61
parent b502ce457e5db45dd9ec1386ff118a474e9cef2f
Author: Lassi Pulkkinen <lassi@pulk.fi>
Date:   Fri, 16 Dec 2022 18:26:29 +0200

Fix double-generation of value expr in multi-append/insert

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>

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

diff --git a/src/gen.c b/src/gen.c @@ -691,8 +691,6 @@ gen_expr_append(struct gen_context *ctx, const struct expression *expr) assert(valtype->array.length != SIZE_UNDEFINED); appendlen = constl(valtype->array.length); } else { - value = gen_expr(ctx, expr->append.value); - qvalue = mkqval(ctx, &value); appendlen = mkqtmp(ctx, ctx->arch.sz, ".%d"); struct qbe_value ptr = mkqtmp(ctx, ctx->arch.ptr, ".%d"); offs = constl(builtin_type_size.size); @@ -2315,8 +2313,6 @@ gen_expr_insert(struct gen_context *ctx, const struct expression *expr) assert(valtype->array.length != SIZE_UNDEFINED); appendlen = constl(valtype->array.length); } else { - value = gen_expr(ctx, expr->append.value); - qvalue = mkqval(ctx, &value); appendlen = mkqtmp(ctx, ctx->arch.sz, ".%d"); struct qbe_value ptr = mkqtmp(ctx, ctx->arch.ptr, ".%d"); offs = constl(builtin_type_size.size);