Closed
Description
In the process of achieving comprehensive test coverage for #1852 I've stumbled upon the following corner case:
julia> using Enzyme
julia> struct Foo
x::Float64
y::Core.Box
dummy(x) = new(x)
end
julia> Enzyme.Compiler.active_reg_inner(Tuple{Foo}, (), nothing, Val(false)#=Val{justActive}=#) # correct
MixedState::ActivityState = 3
julia> Enzyme.Compiler.active_reg_inner(Tuple{Foo}, (), nothing, Val(true)#=Val{justActive}=#) # incorrect, should be ActiveState
AnyState::ActivityState = 0
As far as I understand, justActive = true
is supposed to map MixedState to ActiveState and DupState to AnyState, for when you just want to know whether or not the type contains immutable active storage. This example breaks that mapping.
The problem remains if I replace dummy
with Foo
. I'm using dummy
here to emphasize that it's the incomplete use of new
in the struct definition that triggers the error, rather than something specific to inner constructor methods. The problem also remains if I add a fully initializing inner constructor next to the incomplete one.
The issue disappears with any of the following changes:
- Removing
dummy(x)
- Only invoking
new
in a fully initializing way, e.g.,new(x, Core.Box(nothing))
Metadata
Metadata
Assignees
Labels
No labels