-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen: fix union layout alignment and padding #24197
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
// (also requires change to emit_new_struct to not assume 0 == 0) | ||
if (!isTuple && latypes.size() > 1) { | ||
Type *NoopType = ArrayType::get(T_int1, 0); | ||
latypes.insert(latypes.begin(), NoopType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=)
This introduced a crash when building Julia on #23642. If you pull that branch and cherry-pick e3cd320 (which I have removed from the branch),
I've traced it to |
The Travis build gives more details thanks to LLVM assertions:
|
I'm guessing it hits an i8 array? |
How can I know that? |
Actually it comes from mutable structs with union fields in which case the julia> mutable struct A
x::Union{Int,Void}
end
julia> a = A(1)
A(1)
julia> f(a) = a.x
f (generic function with 1 method)
julia> @code_llvm f(a) |
No description provided.