diff options
| author | Ryan Cumming <etaoins@gmail.com> | 2018-01-27 12:14:12 +1100 |
|---|---|---|
| committer | Ryan Cumming <etaoins@gmail.com> | 2018-01-27 12:57:01 +1100 |
| commit | 75c79bdb0204271e09220c4c59239bb85772ee93 (patch) | |
| tree | 79da2b9cc5e24d3e99c96015c173c709106be51c /src/rustllvm/RustWrapper.cpp | |
| parent | bacb5c58dfdde7c35e99b2b0d8171238cc33cf6c (diff) | |
| download | rust-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
