Skip to content

Commit f736636

Browse files
committed
Throw unsupported error when alignment is not a power of two
1 parent 4a0b744 commit f736636

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/shims/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6060
this.pointer_size()
6161
)? as usize;
6262

63+
// FIXME: This should actually panic in the interpreted program
64+
if !req_align.is_power_of_two() {
65+
throw_unsup_format!("Required alignment should always be a power of two")
66+
}
67+
6368
let ptr_scalar = this.read_scalar(ptr_op)?.not_undef()?;
6469

6570
if let Scalar::Ptr(ptr) = ptr_scalar {

0 commit comments

Comments
 (0)