Skip to content

Commit c1a6df9

Browse files
committed
permit all kinds of 0-offsets on ZSTs
1 parent 2f61356 commit c1a6df9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/eval_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
906906
let ptr = ptr.signed_offset(offset, self.memory.layout)?;
907907
// Do not do bounds-checking for integers or ZST; they can never alias a normal pointer anyway.
908908
if let PrimVal::Ptr(ptr) = ptr {
909-
if !(ptr.points_to_zst() && pointee_size == 0) {
909+
if !(ptr.points_to_zst() && (offset == 0 || pointee_size == 0)) {
910910
self.memory.check_bounds(ptr, false)?;
911911
}
912912
} else if ptr.is_null()? {

0 commit comments

Comments
 (0)