Fix bug where a > 0 ? f() : g() could cause a compiler crash if both returned void!.

This commit is contained in:
Christoffer Lerno
2024-11-09 17:08:31 +01:00
parent acab95792f
commit 746046c8c0
3 changed files with 74 additions and 1 deletions

View File

@@ -4979,11 +4979,12 @@ void gencontext_emit_ternary_expr(GenContext *c, BEValue *value, Expr *expr)
return;
}
if (expr->type == type_void)
if (type_lowering(expr->type) == type_void)
{
llvm_value_set(value, NULL, expr->type);
return;
}
llvm_new_phi(c, value, "val", expr->type, lhs_value, lhs_exit, rhs_value, rhs_exit);
}
static LLVMValueRef llvm_emit_real(LLVMTypeRef type, Float f)