mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-21 05:05:00 -07:00
Fix issue #1592 "LLVM code gen error when using a constant in an if"
Changes lb_build_if_stmt() to return null lbValue if condition is cmpAnd, cmpOr or non-const neg and check in lb_build_if_stmt() to avoid short circuiting if that's the case Adds test to "tests/issues" and adds step in CI to check this dir
This commit is contained in:
@@ -3028,7 +3028,7 @@ lbValue lb_build_expr(lbProcedure *p, Ast *expr) {
|
||||
lbBlock *done = lb_create_block(p, "if.done"); // NOTE(bill): Append later
|
||||
lbBlock *else_ = lb_create_block(p, "if.else");
|
||||
|
||||
lbValue cond = lb_build_cond(p, te->cond, then, else_);
|
||||
lb_build_cond(p, te->cond, then, else_);
|
||||
lb_start_block(p, then);
|
||||
|
||||
Type *type = default_type(type_of_expr(expr));
|
||||
@@ -4646,7 +4646,7 @@ lbAddr lb_build_addr(lbProcedure *p, Ast *expr) {
|
||||
lbBlock *done = lb_create_block(p, "if.done"); // NOTE(bill): Append later
|
||||
lbBlock *else_ = lb_create_block(p, "if.else");
|
||||
|
||||
lbValue cond = lb_build_cond(p, te->cond, then, else_);
|
||||
lb_build_cond(p, te->cond, then, else_);
|
||||
lb_start_block(p, then);
|
||||
|
||||
Type *ptr_type = alloc_type_pointer(default_type(type_of_expr(expr)));
|
||||
|
||||
Reference in New Issue
Block a user