Skip to content

Commit

Permalink
codegen: fix unsoundness in globalop NULL check
Browse files Browse the repository at this point in the history
This code had not considered "mutation tearing", so the emitted
operations could be incorrect if any mutations were dropped.
  • Loading branch information
topolarity committed Jun 6, 2024
1 parent 1fa2162 commit d711729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,7 @@ static jl_cgval_t emit_globalop(jl_codectx_t &ctx, jl_module_t *mod, jl_sym_t *s
return jl_cgval_t();
}
bool isboxed = true;
bool maybe_null = jl_atomic_load_relaxed(&bnd->value) == NULL;
bool maybe_null = (!bnd->isdefined && !bnd->constp) || (jl_atomic_load_relaxed(&bnd->value) == NULL);
return typed_store(ctx,
julia_binding_pvalue(ctx, bp),
rval, cmp, ty,
Expand Down

0 comments on commit d711729

Please sign in to comment.