Skip to content

Add a missing GC root in constant declaration #56408

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

Merged
merged 1 commit into from
Nov 2, 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
6 changes: 5 additions & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,16 @@ static void jl_eval_errorf(jl_module_t *m, const char *filename, int lineno, con

JL_DLLEXPORT jl_binding_partition_t *jl_declare_constant_val2(jl_binding_t *b, jl_module_t *mod, jl_sym_t *var, jl_value_t *val, enum jl_partition_kind constant_kind)
{
JL_GC_PUSH1(&val);
jl_binding_partition_t *bpart = jl_get_binding_partition(b, jl_current_task->world_age);
jl_ptr_kind_union_t pku = jl_atomic_load_relaxed(&bpart->restriction);
int did_warn = 0;
while (1) {
if (jl_bkind_is_some_constant(decode_restriction_kind(pku))) {
if (!val)
if (!val) {
JL_GC_POP();
return bpart;
}
jl_value_t *old = decode_restriction_value(pku);
JL_GC_PROMISE_ROOTED(old);
if (jl_egal(val, old))
Expand Down Expand Up @@ -778,6 +781,7 @@ JL_DLLEXPORT jl_binding_partition_t *jl_declare_constant_val2(jl_binding_t *b, j
break;
}
}
JL_GC_POP();
return bpart;
}

Expand Down