Skip to content

[release-1.11] effects: fix effects of atomic pointer operations (#57806) - #62811

Merged
maleadt merged 1 commit into
release-1.11from
tb/atomic_effects_1.11
Aug 18, 2026
Merged

maleadt merged 1 commit into
release-1.11from
tb/atomic_effects_1.11

Conversation

@maleadt

@maleadt maleadt commented Aug 18, 2026

Copy link
Copy Markdown
Member

Backport #57806 to 1.11, which surfaces as a miscompilation in JuliaGPU/AcceleratedKernels.jl#97.

The `_unsetindex!(::GenericMemoryRef)` function was being concretely
evaluated (meaning the code was actually being run during inference) by
the `REPLInterpreter`.

The root cause is that the Base compiler system forgot to mark
`atomic_pointerset` as "effect-free".

This is simply a bug in the effect system. It didn't cause problems
during normal Base compilation because `atomic_pointerset` was correctly
marked as "consistent" (concrete evaluation requires both "consistent"
and "effect-free"). However, this was still a pretty risky situation.

The reason this only caused problems with REPL completion is that the
`REPLInterpreter` intentionally ignores the "consistent" requirement
under certain conditions to achieve better completion accuracy. This is
usually fine, but it relies on "effect-free" being correctly marked. So,
when there's a critical bug like this in the effect system, these kinds
of dangerous issues can occur.

As discussed with Jameson earlier, the effects of atomic pointer
operations are not precisely defined.
This commit includes the minimal changes necessary to fix
#57780, but a more extensive audit is planned for later.

- closes #57780

(cherry picked from commit 6a32f7a)

Adapted for release-1.11: the compiler lives in `base/compiler/` rather
than `Compiler/`, and `intrinsic_effects` keeps this branch's varargs
guard on `nothrow`. Otherwise identical to the change that shipped in
1.12 (e4e489a).

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Assisted-by: Claude Code (Opus 5)
@maleadt
maleadt merged commit 8bedb59 into release-1.11 Aug 18, 2026
6 checks passed
@maleadt
maleadt deleted the tb/atomic_effects_1.11 branch August 18, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant