Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing gc-root store in subtype #56472

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/subtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -4700,12 +4700,12 @@ static jl_value_t *insert_nondiagonal(jl_value_t *type, jl_varbinding_t *troot,
jl_value_t *n = jl_unwrap_vararg_num(type);
if (widen2ub == 0)
widen2ub = !(n && jl_is_long(n)) || jl_unbox_long(n) > 1;
jl_value_t *newt;
JL_GC_PUSH2(&newt, &n);
newt = insert_nondiagonal(t, troot, widen2ub);
if (t != newt)
jl_value_t *newt = insert_nondiagonal(t, troot, widen2ub);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just an optimization? Or is this the actual fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a similar fix, though not actually the one that crashed

if (t != newt) {
JL_GC_PUSH1(&newt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe use a comment that n doesn't need the root because it derives from type? I could see someone accidentally refactoring this to overwrite type early.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is an argument, so you cannot overwrite it, and the gc verifier would probably catch that mistake anyways

type = (jl_value_t *)jl_wrap_vararg(newt, n, 0, 0);
JL_GC_POP();
JL_GC_POP();
}
}
else if (jl_is_datatype(type)) {
if (jl_is_tuple_type(type)) {
Expand Down Expand Up @@ -4742,7 +4742,7 @@ static jl_value_t *_widen_diagonal(jl_value_t *t, jl_varbinding_t *troot) {
static jl_value_t *widen_diagonal(jl_value_t *t, jl_unionall_t *u, jl_varbinding_t *troot)
{
jl_varbinding_t vb = { u->var, NULL, NULL, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, troot };
jl_value_t *nt;
jl_value_t *nt = NULL;
JL_GC_PUSH2(&vb.innervars, &nt);
if (jl_is_unionall(u->body))
nt = widen_diagonal(t, (jl_unionall_t *)u->body, &vb);
Expand Down
Loading