From 8a8e1a7f73f00ecda9eb68134ee742f262272ffb Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Tue, 10 Jan 2012 16:50:13 -0800 Subject: [PATCH] Fix bug with multiple EmitCode() calls due to missing braces. In short, we were inadvertently trying to emit each function's code a second time if the function had a mask check at the start of it. StmtList::EmitCode() was covering this error up by not emitting code if the current basic block is NULL. --- func.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/func.cpp b/func.cpp index 6f5e03db..26ea83ed 100644 --- a/func.cpp +++ b/func.cpp @@ -334,11 +334,12 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function, if (ctx->GetCurrentBasicBlock()) ctx->ReturnInst(); } - else + else { // Set up basic blocks for goto targets ctx->InitializeLabelMap(code); // No check, just emit the code code->EmitCode(ctx); + } } if (ctx->GetCurrentBasicBlock()) {