Don't read from zero sized fields
This commit is contained in:
parent
d26ebec81c
commit
3d8c4d4fe9
1 changed files with 3 additions and 0 deletions
|
@ -123,6 +123,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
|||
}
|
||||
let field_index = field.index();
|
||||
let field = base_layout.field(self, field_index)?;
|
||||
if field.size.bytes() == 0 {
|
||||
return Ok(Some((Value::ByVal(PrimVal::Undef), field.ty)))
|
||||
}
|
||||
let offset = base_layout.fields.offset(field_index);
|
||||
match base {
|
||||
// the field covers the entire type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue