Skip to content

Commit

Permalink
dangling-ptr-to-int should work now
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 5, 2019
1 parent b75e917 commit dbe0f1f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/run-pass/malloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ fn main() {
let saw_unaligned = (0..64).any(|_| unsafe {
let p = libc::malloc(3);
let addr = p as usize;
let unaligned = addr % 4 != 0; // test that this is not 4-aligned
libc::free(p); // FIXME have to free *after* test; should allow ptr-to-int of dangling ptr.
unaligned
libc::free(p);
(p as usize) % 4 != 0 // find any that this is *not* 4-aligned
});
assert!(saw_unaligned);

Expand Down

0 comments on commit dbe0f1f

Please sign in to comment.