about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorRyan Cumming <etaoins@gmail.com>2018-01-27 12:14:12 +1100
committerRyan Cumming <etaoins@gmail.com>2018-01-27 12:57:01 +1100
commit75c79bdb0204271e09220c4c59239bb85772ee93 (patch)
tree79da2b9cc5e24d3e99c96015c173c709106be51c /src/rustllvm/RustWrapper.cpp
parentbacb5c58dfdde7c35e99b2b0d8171238cc33cf6c (diff)
downloadrust-75c79bdb0204271e09220c4c59239bb85772ee93.tar.gz
rust-75c79bdb0204271e09220c4c59239bb85772ee93.zip
Fix ICE on const eval of union field
MIR's `Const::get_field()` attempts to retrieve the value for a given
field in a constant. In the case of a union constant it was falling
through to a generic `const_get_elt` based on the field index. As union
fields don't have an index this caused an ICE in `llvm_field_index`.

Fix by simply returning the current value when accessing any field in a
union. This works because all union fields start at byte offset 0.

The added test uses `const_fn` it ensure the field is extracted using
MIR's const evaluation. The crash is reproducible without it, however.

Fixes #47788
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions