Skip to content

Commit

Permalink
dangling-ptr-to-int should work now; move to noseed
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 5, 2019
1 parent b75e917 commit 029a294
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/run-pass/malloc.rs → tests/run-pass-noseed/malloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ fn main() {
// Test that small allocations sometimes *are* not very aligned.
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 029a294

Please sign in to comment.