Throw unsupported error when alignment is not a power of two

This commit is contained in:
Christian Poveda 2019-09-17 13:42:04 -05:00
parent 4a0b7446cf
commit f736636038

View File

@ -60,6 +60,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
this.pointer_size()
)? as usize;
// FIXME: This should actually panic in the interpreted program
if !req_align.is_power_of_two() {
throw_unsup_format!("Required alignment should always be a power of two")
}
let ptr_scalar = this.read_scalar(ptr_op)?.not_undef()?;
if let Scalar::Ptr(ptr) = ptr_scalar {