Skip to content

Commit 7045b14

Browse files
committed
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.
1 parent a39f318 commit 7045b14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ssa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ void new_name(block_t *block, var_t **var)
697697
var_t *get_stack_top_subscript_var(var_t *var)
698698
{
699699
if (var->base->rename.stack_idx < 1)
700-
error("Index is less than 1");
700+
fatal("Index is less than 1");
701701

702702
int sub = var->base->rename.stack[var->base->rename.stack_idx - 1];
703703
for (int i = 0; i < var->base->subscripts_idx; i++) {

0 commit comments

Comments
 (0)