evaluate required_consts when pushing stack frame in Miri engine

This commit is contained in:
Ralf Jung 2020-08-09 17:47:29 +02:00
parent bff69c9525
commit a0e057540e

View File

@ -652,6 +652,13 @@ pub fn push_stack_frame(
let frame = M::init_frame_extra(self, pre_frame)?;
self.stack_mut().push(frame);
// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
for const_ in &body.required_consts {
let const_ =
self.subst_from_current_frame_and_normalize_erasing_regions(const_.literal);
self.const_to_op(const_, None)?;
}
// Locals are initially uninitialized.
let dummy = LocalState { value: LocalValue::Uninitialized, layout: Cell::new(None) };
let mut locals = IndexVec::from_elem(dummy, &body.local_decls);