Skip to content

Nested parameterised structs fail to propagate bitstypeness in Julia 1.7.0 #43303

Closed

Description

It appears 1.7.0 fails to correctly preserve bitstypeness of parameterised types in some situations. Here's a reproducible, original failing case was using UnsafeArrays.jl. In real world code, this leads to allocations and performance regressions.

Reproducible

struct UnsafeArray{T,N}
    pointer::Ptr{T}
    size::NTuple{N,Int}
end

struct X{T}
    x::T
end

struct Y{T}
    x::UnsafeArray{X{T}, 1}
end

struct Y2
    x::UnsafeArray{X{Int}, 1}
end

@show isbitstype(Y{Int})
@show isbitstype(UnsafeArray{Int, 1})
@show isbitstype(Y2)

Julia 1.7.0 output

isbitstype(Y{Int}) = false
isbitstype(UnsafeArray{Int, 1}) = true
isbitstype(Y2) = true

Julia 1.6.4 output

isbitstype(Y{Int}) = true
isbitstype(UnsafeArray{Int, 1}) = true
isbitstype(Y2) = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

regressionRegression in behavior compared to a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions