- Incorrect handling of constant null fault causing compiler crash #2232.

This commit is contained in:
Christoffer Lerno
2025-06-20 15:29:52 +02:00
parent cd3e924d1e
commit 20c13c0bb4
10 changed files with 197 additions and 10 deletions

View File

@@ -3076,6 +3076,7 @@ void llvm_emit_int_comp_raw(GenContext *c, BEValue *result, Type *lhs_type, Type
}
}
}
ASSERT(LLVMTypeOf(lhs_value) == LLVMTypeOf(rhs_value));
if (lhs_signed && !rhs_signed && !vector_type && llvm_is_const(lhs_value) && type_size(lhs_type) <= 8)
@@ -4765,8 +4766,7 @@ static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr)
case CONST_FAULT:
{
Decl *decl = expr->const_expr.fault;
ASSERT(decl);
LLVMValueRef value = LLVMBuildPtrToInt(c->builder, llvm_get_ref(c, decl), llvm_get_type(c, type_fault), "");
LLVMValueRef value = decl ? LLVMBuildPtrToInt(c->builder, llvm_get_ref(c, decl), llvm_get_type(c, type_fault), "") : llvm_get_zero(c, type_fault);
llvm_value_set(be_value, value, type_fault);
return;
}