Skip to content

Commit cbfe9a4

Browse files
committedJul 18, 2018
fix @setEvalBranchQuota not respected in generic fn calls
closes #1257
·
0.15.10.3.0
1 parent 6394f7e commit cbfe9a4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎src/ir.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13092,6 +13092,7 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
1309213092
impl_fn->ir_executable.parent_exec = ira->new_irb.exec;
1309313093
impl_fn->analyzed_executable.source_node = call_instruction->base.source_node;
1309413094
impl_fn->analyzed_executable.parent_exec = ira->new_irb.exec;
13095+
impl_fn->analyzed_executable.backward_branch_quota = ira->new_irb.exec->backward_branch_quota;
1309513096
impl_fn->analyzed_executable.is_generic_instantiation = true;
1309613097

1309713098
ira->codegen->fn_defs.append(impl_fn);

‎test/cases/eval.zig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,3 +642,13 @@ test "@tagName of @typeId" {
642642
const str = @tagName(@typeId(u8));
643643
assert(std.mem.eql(u8, str, "Int"));
644644
}
645+
646+
test "setting backward branch quota just before a generic fn call" {
647+
@setEvalBranchQuota(1001);
648+
loopNTimes(1001);
649+
}
650+
651+
fn loopNTimes(comptime n: usize) void {
652+
comptime var i = 0;
653+
inline while (i < n) : (i += 1) {}
654+
}

0 commit comments

Comments
 (0)
Please sign in to comment.