Skip to content

Commit

Permalink
Fix three missing gc roots in subtyping
Browse files Browse the repository at this point in the history
All found by static analysis. I'm hoping one of them might have
been the cause of CI failures like this one:

https://circleci.com/gh/JuliaLang/julia/33846?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
(cherry picked from commit 640fc09)
  • Loading branch information
Keno authored and KristofferC committed Aug 19, 2018
1 parent 04d7e34 commit 227cefd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,9 @@ static jl_value_t *fix_inferred_var_bound(jl_tvar_t *var, jl_value_t *ty)
{
if (!jl_is_typevar(ty) && jl_has_free_typevars(ty)) {
jl_value_t *ans = ty;
jl_array_t *vs = jl_find_free_typevars(ty);
jl_array_t *vs = NULL;
JL_GC_PUSH2(&ans, &vs);
vs = jl_find_free_typevars(ty);
int i;
for (i = 0; i < jl_array_len(vs); i++) {
ans = jl_type_unionall((jl_tvar_t*)jl_array_ptr_ref(vs, i), ans);
Expand Down Expand Up @@ -630,7 +631,7 @@ static int subtype_unionall(jl_value_t *t, jl_unionall_t *u, jl_stenv_t *e, int8
btemp = btemp->prev;
}
jl_varbinding_t vb = { u->var, u->var->lb, u->var->ub, R, NULL, 0, 0, 0, 0, e->invdepth, 0, NULL, e->vars };
JL_GC_PUSH3(&u, &vb.lb, &vb.ub);
JL_GC_PUSH4(&u, &vb.lb, &vb.ub, &vb.innervars);
e->vars = &vb;
int ans;
if (R) {
Expand Down Expand Up @@ -1731,7 +1732,9 @@ static int intersect_vararg_length(jl_value_t *v, ssize_t n, jl_stenv_t *e, int8
// only do the check if N is free in the tuple type's last parameter
if (jl_is_typevar(N) && N != (jl_value_t*)va_p1 && N != (jl_value_t*)va_p2) {
jl_value_t *len = jl_box_long(n);
JL_GC_PUSH1(&len);
jl_value_t *il = R ? intersect(len, N, e, 2) : intersect(N, len, e, 2);
JL_GC_POP();
if (il == jl_bottom_type)
return 0;
}
Expand Down

0 comments on commit 227cefd

Please sign in to comment.