Skip to content

Conversation

@serenity4
Copy link
Member

Fixes #59222.

This issue was caused by a mismatch with jl_new_opaque_closure_from_code_info_in_world filling in the unnormalized method instance, and new_opaque_closure getting its spec_ptr from the normalized one via jl_compile_method_internal.

For example, g(xs...) specialized as g(:a, :b) resulted in a different method instance than the corresponding normalized one:

Tuple{Tuple{typeof(Main.g)}, Symbol, Symbol} # unnormalized
Tuple{Tuple{typeof(Main.g)}, Symbol, Vararg{Symbol}} # normalized

Here I chose to align on using the unnormalized one from the CodeInfo at OpaqueClosure construction (the fix being a single-line change in that case), but we could also choose the normalized one if that is deemed preferable, so long as we use the same when storing the inferred code and when retrieving the spec_ptr.


🤖 Generated with some assistance from Claude Code.

@KristofferC KristofferC added the backport 1.12 Change should be backported to release-1.12 label Oct 7, 2025
Copy link
Member

@topolarity topolarity left a comment

Choose a reason for hiding this comment

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

Thanks!

@topolarity topolarity merged commit e8667fb into JuliaLang:master Oct 7, 2025
8 checks passed
KristofferC pushed a commit that referenced this pull request Oct 10, 2025
Fixes #59222.

This issue was caused by a mismatch with
`jl_new_opaque_closure_from_code_info_in_world` filling in the
unnormalized method instance, and `new_opaque_closure` getting its
`spec_ptr` from the normalized one via `jl_compile_method_internal`.

For example, `g(xs...)` specialized as `g(:a, :b)` resulted in a
different method instance than the corresponding normalized one:
```julia
Tuple{Tuple{typeof(Main.g)}, Symbol, Symbol} # unnormalized
Tuple{Tuple{typeof(Main.g)}, Symbol, Vararg{Symbol}} # normalized
```

Here I chose to align on using the unnormalized one from the `CodeInfo`
at `OpaqueClosure` construction (the fix being a single-line change in
that case), but we could also choose the normalized one if that is
deemed preferable, so long as we use the same when storing the inferred
code and when retrieving the `spec_ptr`.

---

🤖 Generated with some assistance from Claude Code.

(cherry picked from commit e8667fb)
@KristofferC KristofferC mentioned this pull request Oct 10, 2025
47 tasks
KristofferC pushed a commit that referenced this pull request Oct 12, 2025
Fixes #59222.

This issue was caused by a mismatch with
`jl_new_opaque_closure_from_code_info_in_world` filling in the
unnormalized method instance, and `new_opaque_closure` getting its
`spec_ptr` from the normalized one via `jl_compile_method_internal`.

For example, `g(xs...)` specialized as `g(:a, :b)` resulted in a
different method instance than the corresponding normalized one:
```julia
Tuple{Tuple{typeof(Main.g)}, Symbol, Symbol} # unnormalized
Tuple{Tuple{typeof(Main.g)}, Symbol, Vararg{Symbol}} # normalized
```

Here I chose to align on using the unnormalized one from the `CodeInfo`
at `OpaqueClosure` construction (the fix being a single-line change in
that case), but we could also choose the normalized one if that is
deemed preferable, so long as we use the same when storing the inferred
code and when retrieving the `spec_ptr`.

---

🤖 Generated with some assistance from Claude Code.

(cherry picked from commit e8667fb)
KristofferC pushed a commit that referenced this pull request Oct 14, 2025
Fixes #59222.

This issue was caused by a mismatch with
`jl_new_opaque_closure_from_code_info_in_world` filling in the
unnormalized method instance, and `new_opaque_closure` getting its
`spec_ptr` from the normalized one via `jl_compile_method_internal`.

For example, `g(xs...)` specialized as `g(:a, :b)` resulted in a
different method instance than the corresponding normalized one:
```julia
Tuple{Tuple{typeof(Main.g)}, Symbol, Symbol} # unnormalized
Tuple{Tuple{typeof(Main.g)}, Symbol, Vararg{Symbol}} # normalized
```

Here I chose to align on using the unnormalized one from the `CodeInfo`
at `OpaqueClosure` construction (the fix being a single-line change in
that case), but we could also choose the normalized one if that is
deemed preferable, so long as we use the same when storing the inferred
code and when retrieving the `spec_ptr`.

---

🤖 Generated with some assistance from Claude Code.

(cherry picked from commit e8667fb)
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Oct 21, 2025
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.

Opaque closure vararg segfault on 1.12

4 participants