Skip to content

Commit

Permalink
Fix inInference state corruption.
Browse files Browse the repository at this point in the history
This led to non-idempotent irgen.
  • Loading branch information
vtjnash authored and maleadt committed Jun 10, 2017
1 parent ff3a9aa commit f91d54f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ jl_code_info_t *jl_type_infer(jl_method_instance_t **pli, size_t world, int forc
li->inInference = 1;
jl_svec_t *linfo_src_rettype = (jl_svec_t*)jl_apply_with_saved_exception_state(fargs, 3, 0);
ptls->world_age = last_age;
assert((jl_is_method(li->def.method) || li->inInference == 0) && "inference failed on a toplevel expr");
li->inInference = 0;

jl_code_info_t *src = NULL;
if (linfo_src_rettype &&
Expand Down
7 changes: 7 additions & 0 deletions test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -856,3 +856,10 @@ let f, m
]
@test @inferred(f()) == 6
end

# issue #22290
f22290() = return nothing
for i in 1:3
ir = sprint(io->code_llvm(io, f22290, Tuple{}))
@test contains(ir, "julia_f22290")
end
2 changes: 1 addition & 1 deletion test/staged.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ let gf_err, tsk = @async nothing # create a Task for yield to try to run
end
@test_throws ErrorException gf_err()
@test_throws ErrorException gf_err()
@test gf_err_ref[] == 3
@test gf_err_ref[] == 4
end

gf_err_ref[] = 0
Expand Down

0 comments on commit f91d54f

Please sign in to comment.