Auto merge of #51225 - oli-obk:miri_oob_ptr, r=eddyb
Fix the miri submodule cc @bjorn3 r? @eddyb
This commit is contained in:
commit
1dcda69586
@ -793,7 +793,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
|
||||
let ty = self.place_ty(place);
|
||||
let place = self.eval_place(place)?;
|
||||
let discr_val = self.read_discriminant_value(place, ty)?;
|
||||
let defined = self.layout_of(ty).unwrap().size.bits() as u8;
|
||||
let defined = self.layout_of(dest_ty).unwrap().size.bits() as u8;
|
||||
self.write_scalar(dest, Scalar::Bits {
|
||||
bits: discr_val,
|
||||
defined,
|
||||
|
@ -844,7 +844,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
|
||||
}
|
||||
|
||||
// Forget all the relocations.
|
||||
alloc.relocations.remove_range(first ..= last);
|
||||
alloc.relocations.remove_range(first..last);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -39,12 +39,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
||||
} => {
|
||||
let discr_val = self.eval_operand(discr)?;
|
||||
let discr_prim = self.value_to_scalar(discr_val)?;
|
||||
let discr_layout = self.layout_of(discr_val.ty).unwrap();
|
||||
trace!("SwitchInt({:?}, {:#?})", discr_prim, discr_layout);
|
||||
let discr_prim = discr_prim.to_bits(discr_layout.size)?;
|
||||
|
||||
// Branch to the `otherwise` case by default, if no match is found.
|
||||
let mut target_block = targets[targets.len() - 1];
|
||||
|
||||
for (index, &const_int) in values.iter().enumerate() {
|
||||
if discr_prim.to_bits(self.layout_of(discr_val.ty).unwrap().size)? == const_int {
|
||||
if discr_prim == const_int {
|
||||
target_block = targets[index];
|
||||
break;
|
||||
}
|
||||
@ -288,10 +291,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
||||
// and need to pack arguments
|
||||
Abi::Rust => {
|
||||
trace!(
|
||||
"arg_locals: {:?}",
|
||||
"arg_locals: {:#?}",
|
||||
self.frame().mir.args_iter().collect::<Vec<_>>()
|
||||
);
|
||||
trace!("args: {:?}", args);
|
||||
trace!("args: {:#?}", args);
|
||||
let local = arg_locals.nth(1).unwrap();
|
||||
for (i, &valty) in args.into_iter().enumerate() {
|
||||
let dest = self.eval_place(&mir::Place::Local(local).field(
|
||||
@ -318,10 +321,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
||||
let mut arg_locals = self.frame().mir.args_iter();
|
||||
trace!("ABI: {:?}", sig.abi);
|
||||
trace!(
|
||||
"arg_locals: {:?}",
|
||||
"arg_locals: {:#?}",
|
||||
self.frame().mir.args_iter().collect::<Vec<_>>()
|
||||
);
|
||||
trace!("args: {:?}", args);
|
||||
trace!("args: {:#?}", args);
|
||||
match sig.abi {
|
||||
Abi::RustCall => {
|
||||
assert_eq!(args.len(), 2);
|
||||
@ -373,14 +376,26 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
||||
}
|
||||
break;
|
||||
}
|
||||
let dest = self.eval_place(&mir::Place::Local(
|
||||
arg_locals.next().unwrap(),
|
||||
))?;
|
||||
let valty = ValTy {
|
||||
value: other,
|
||||
ty: layout.ty,
|
||||
};
|
||||
self.write_value(valty, dest)?;
|
||||
{
|
||||
let mut write_next = |value| {
|
||||
let dest = self.eval_place(&mir::Place::Local(
|
||||
arg_locals.next().unwrap(),
|
||||
))?;
|
||||
let valty = ValTy {
|
||||
value: Value::Scalar(value),
|
||||
ty: layout.ty,
|
||||
};
|
||||
self.write_value(valty, dest)
|
||||
};
|
||||
match other {
|
||||
Value::Scalar(value) | Value::ScalarPair(value, _) => write_next(value)?,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
if let Value::ScalarPair(_, value) = other {
|
||||
write_next(value)?;
|
||||
}
|
||||
}
|
||||
assert!(arg_locals.next().is_none());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 6a4c62c1673c3dabcc9a0c99018bd08fec46fda7
|
||||
Subproject commit 066a284557ff6e6a2aa19084f599f167a724af7b
|
Loading…
x
Reference in New Issue
Block a user