about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorJed Davis <jld@panix.com>2014-03-04 20:41:21 -0800
committerJed Davis <jld@panix.com>2014-03-05 21:23:33 -0800
commitd90830221e76ca41ac336a32f308f58e45ca4ae8 (patch)
treef0f73df2afb666306e3c90913db65fc2071334f0 /src/rustllvm/ExecutionEngineWrapper.cpp
parent67c5d793add67878e6e472258748ac13e0f90366 (diff)
downloadrust-d90830221e76ca41ac336a32f308f58e45ca4ae8.tar.gz
rust-d90830221e76ca41ac336a32f308f58e45ca4ae8.zip
Fix ICE on statics with fancy nullable enums.
Closes #8506.

The `trans::adt` code for statics uses fields with `C_undef` values to
insert alignment padding (because LLVM's own alignment padding isn't
always sufficient for aggregate constants), and assumes that all fields
in the actual Rust value are represented by non-undef LLVM values, to
distinguish them from that padding.

But for nullable pointer enums, if non-null variant has fields other
than the pointer used as the discriminant, they would be set to undef in
the null case, to reflect that they're never accessed.

To avoid the obvious conflict between these two items, the latter undefs
were wrapped in unary LLVM structs to distinguish them from the former
undefs.  Except this doesn't actually work -- LLVM, not unreasonably,
treats the "wrapped undef" as a regular undef.

So this commit just sets all fields to null in the null pointer case of
a nullable pointer enum static, because the other fields don't really
need to be undef in the first place.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions