Skip to content

Opaque closure vararg segfault on 1.12 #59222

@mhauru

Description

@mhauru

This:

module MWE

g(xs...) = 1

# Make a callable out of the format that OpaqueClosure expects, where the first
# argument is a Tuple of the captures. `code_ircode` on this yields IR that can
# be fed to the Core.OpaqueClosure constructor, with g as a capture.
(t::Tuple{typeof(g)})(xs...) = t[1](xs...)
ir = Base.code_ircode_by_type(Tuple{Tuple{typeof(g)}, Symbol, Symbol})[1][1]
ir.argtypes[1] = Tuple{typeof(g)}

oc = Core.OpaqueClosure(ir, g; isva=true, do_compile=true)
oc(:a, :b)  # segfault on 1.12

end

segfaults on 1.12.0-rc1 as well as master from last week, but passes fine on 1.11.6.

Has there been an intentional change to opaque closure varargs on 1.12 that I don't understand, or is this a bug? cc @willtebbutt who is likewise confused by this.

Metadata

Metadata

Assignees

Labels

compiler:codegenGeneration of LLVM IR and native code

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions