Incorrect codegen if a macro ends with unreachable and is assigned to something. #2210

This commit is contained in:
Christoffer Lerno
2025-06-15 22:35:44 +02:00
parent 07eee04e94
commit 3ce15bd7af
3 changed files with 41 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ BEValue llvm_emit_assign_expr(GenContext *c, BEValue *ref, Expr *expr, LLVMValue
BEValue result;
// Emit the fault type.
llvm_emit_expr(c, &result, expr->inner_expr);
llvm_value_rvalue(c, &result);
LLVMValueRef err_val = result.value;
@@ -201,7 +202,7 @@ BEValue llvm_emit_assign_expr(GenContext *c, BEValue *ref, Expr *expr, LLVMValue
{
llvm_emit_expr(c, &value, expr);
}
if (!c->current_block) goto AFTER_STORE;
if (value.type != type_void) llvm_store(c, ref, &value);
}
@@ -209,6 +210,7 @@ BEValue llvm_emit_assign_expr(GenContext *c, BEValue *ref, Expr *expr, LLVMValue
{
llvm_store_to_ptr_raw(c, optional, llvm_get_zero(c, type_fault), type_fault);
}
AFTER_STORE:;
POP_CATCH();
if (assign_block)