harec

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

commit 375157c803be3846979a53dc6c3d148378023489
parent 7a40d6076e9c63bf76ab6a9c37315a9582ff4f07
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Sun,  7 Mar 2021 16:51:18 -0500

Use `fixed_aborts` values as fixed abort reasons

Diffstat:
Minclude/gen.h | 1+
Msrc/gen.c | 4++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/gen.h b/include/gen.h @@ -10,6 +10,7 @@ enum fixed_aborts { ABORT_OOB = 0, ABORT_TYPE_ASSERTION = 1, + ABORT_ALLOC_FAILURE = 2 }; struct unit; diff --git a/src/gen.c b/src/gen.c @@ -590,7 +590,7 @@ gen_expr_alloc(struct gen_context *ctx, pushi(ctx->current, NULL, Q_JMP, &bend, NULL); } else { struct qbe_value reason = {0}, rtabort = {0}; - constl(&reason, 2); + constl(&reason, ABORT_ALLOC_FAILURE); rtabort.kind = QV_GLOBAL; rtabort.name = strdup("rt.abort_fixed"); rtabort.type = &qbe_long; @@ -789,7 +789,7 @@ gen_expr_assign_slice(struct gen_context *ctx, rtabort.kind = QV_GLOBAL; rtabort.name = strdup("rt.abort_fixed"); rtabort.type = &qbe_long; - constl(&temp, 0); + constl(&temp, ABORT_OOB); pushi(ctx->current, NULL, Q_CALL, &rtabort, &temp, NULL); push(&ctx->current->body, &equall);