harec

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

commit 967f31f45e53e7142686bfc1e2c1de21246155b1
parent cfcc22785c94716c0e96be23081d8bfd1f6c0466
Author: Ember Sawady <ecs@d2evs.net>
Date:   Sun, 22 Jan 2023 22:12:10 +0000

Fix null check for slice alloc

Signed-off-by: Ember Sawady <ecs@d2evs.net>

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

diff --git a/src/gen.c b/src/gen.c @@ -416,7 +416,7 @@ gen_alloc_slice_at(struct gen_context *ctx, struct qbe_statement linvalid; struct qbe_value binvalid = mklabel(ctx, &linvalid, ".%d"); - pushi(ctx->current, &cmpres, Q_CNEL, &size, &zero, NULL); + pushi(ctx->current, &cmpres, Q_CNEL, &data, &zero, NULL); pushi(ctx->current, NULL, Q_JNZ, &cmpres, &bzero, &binvalid, NULL); push(&ctx->current->body, &linvalid); gen_fixed_abort(ctx, expr->loc, ABORT_ALLOC_FAILURE);