Skip to content

Commit de090a9

Browse files
authored
[Compiler] Add more tests for non-power-of-two primitive types (JuliaLang#58437)
The issue reported in JuliaLang#42326 (inconsistent sizes for structs involving primitive types with non-power-of-two sizes) is already fixed since upgrading to LLVM 18, this PR adds regressions tests. I verified they already pass on x86_64, i686 and aarch64. Close JuliaLang#42326.
1 parent fc456bd commit de090a9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Compiler/test/codegen.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,16 @@ for (T, StructName) in ((Int128, :Issue55558), (UInt128, :UIssue55558))
951951
end
952952
end
953953

954+
# Issue #42326
955+
primitive type PadAfter64_42326 448 end
956+
mutable struct CheckPadAfter64_42326
957+
a::UInt64
958+
pad::PadAfter64_42326
959+
b::UInt64
960+
end
961+
@test fieldoffset(CheckPadAfter64_42326, 3) == 80
962+
@test sizeof(CheckPadAfter64_42326) == 96
963+
954964
@noinline Base.@nospecializeinfer f55768(@nospecialize z::UnionAll) = z === Vector
955965
@test f55768(Vector)
956966
@test f55768(Vector{T} where T)

0 commit comments

Comments
 (0)