diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2018-02-25 00:13:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-25 00:13:02 +0000 |
| commit | b74ae77745bd62662679348d56de7537f27ee3ce (patch) | |
| tree | b4e399a531c41312de3f515515ba671620d06742 /src/ir.cpp | |
| parent | 35ba5771a5dbe5fec3fea8804fb46fe843478830 (diff) | |
| parent | 564226be02d30a8179026847a894cf07fbc19f9a (diff) | |
Merge pull request #197 from bpunsky/context-bug-fix
Context bug fix
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 1a33f17e1..9613f7192 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -1650,6 +1650,12 @@ irValue *ir_find_or_generate_context_ptr(irProcedure *proc) { if (proc->context_stack.count > 0) { return proc->context_stack[proc->context_stack.count-1]; } + + irBlock *tmp_block = proc->curr_block; + proc->curr_block = proc->blocks[0]; + + defer (proc->curr_block = tmp_block); + irValue *c = ir_add_local_generated(proc, t_context); array_add(&proc->context_stack, c); ir_emit_store(proc, c, ir_emit_load(proc, proc->module->global_default_context)); |