From f647187e5332408ad3038f65e63693e019b70ccb Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 1 Jan 2019 11:59:09 +0000 Subject: [PATCH] Fix defer on branching with new scoping rules --- core/fmt/fmt.odin | 2 +- src/ir.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 73a848764..e8dafb2c7 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -523,7 +523,7 @@ fmt_write_padding :: proc(fi: ^Fmt_Info, width: int) { pad_byte: byte = '0'; if fi.space do pad_byte = ' '; - for _ in 0..width-1 { + for i := 0; i < width; i += 1 { write_byte(fi.buf, pad_byte); } } diff --git a/src/ir.cpp b/src/ir.cpp index 77a515245..a8b2e77c3 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2967,7 +2967,7 @@ void ir_emit_defer_stmts(irProcedure *proc, irDeferExitKind kind, irBlock *block ir_build_defer_stmt(proc, d); } else if (kind == irDeferExit_Branch) { GB_ASSERT(block != nullptr); - isize lower_limit = block->scope_index+1; + isize lower_limit = block->scope_index; if (lower_limit < d.scope_index) { ir_build_defer_stmt(proc, d); }