Why does `reinterpret` cause an extra allocation?

Does not fix the speed on my machine :frowning:

I’ll rebuild and try more systematically again later.
[edit: still not fixed for me.]

PS about the padding: Now I believe its mostly leftover register contents, not stack memory; but whatever happens probably depends a lot on how the compiler feels today. Well, the filling of the padding is UB, so whatever.

After pondering the source of reinterpret-array:

struct bax2
       a::Int8
       b::Int
       c::Int8
end

 A4=[bax2(-1,-1,-1)];
A4r=reinterpret(UInt8, A4);
@show A4r[2];
# A4r[2] = 0xfd
A4r[2]=2;
@show A4r[2];
#A4r[2] = 0xfd

I guess I’ll open an issue for that one, even though the fact that reinterpret goes via abstract array kinda implies this problem (it would be valid, I think, to have a “structure-packed array” where the padding bytes simply don’t exist and hence cannot be reinterpreted-- ie sizeof is not informative for abstract arrays that don’t guarantee a contiguous memory layout).

edit: Issue opened, https://github.com/JuliaLang/julia/issues/25908