Skip to content

Commit

Permalink
permit all kinds of 0-offsets on ZSTs
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 22, 2017
1 parent 2f61356 commit c1a6df9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
let ptr = ptr.signed_offset(offset, self.memory.layout)?;
// Do not do bounds-checking for integers or ZST; they can never alias a normal pointer anyway.
if let PrimVal::Ptr(ptr) = ptr {
if !(ptr.points_to_zst() && pointee_size == 0) {
if !(ptr.points_to_zst() && (offset == 0 || pointee_size == 0)) {
self.memory.check_bounds(ptr, false)?;
}
} else if ptr.is_null()? {
Expand Down

0 comments on commit c1a6df9

Please sign in to comment.