From 7045b14b73de7a2232c8c7c56aa71baf26d509c7 Mon Sep 17 00:00:00 2001 From: Kyle Lin Date: Tue, 15 Jul 2025 15:15:51 +0800 Subject: [PATCH] Fix potential segfault when reporting error When reaching to SSA phase, the "error" function would always cause segment fault due to the internal design, which is the source index is always going to be out of bound. In this patch, we instead use "fatal" function to avoid this issue. --- src/ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssa.c b/src/ssa.c index f4528332..fa7b74fe 100644 --- a/src/ssa.c +++ b/src/ssa.c @@ -697,7 +697,7 @@ void new_name(block_t *block, var_t **var) var_t *get_stack_top_subscript_var(var_t *var) { if (var->base->rename.stack_idx < 1) - error("Index is less than 1"); + fatal("Index is less than 1"); int sub = var->base->rename.stack[var->base->rename.stack_idx - 1]; for (int i = 0; i < var->base->subscripts_idx; i++) {