Skip to content

Commit 029a294

Browse files
committed
dangling-ptr-to-int should work now; move to noseed
1 parent b75e917 commit 029a294

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/run-pass/malloc.rs renamed to tests/run-pass-noseed/malloc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ fn main() {
1111
// Test that small allocations sometimes *are* not very aligned.
1212
let saw_unaligned = (0..64).any(|_| unsafe {
1313
let p = libc::malloc(3);
14-
let addr = p as usize;
15-
let unaligned = addr % 4 != 0; // test that this is not 4-aligned
16-
libc::free(p); // FIXME have to free *after* test; should allow ptr-to-int of dangling ptr.
17-
unaligned
14+
libc::free(p);
15+
(p as usize) % 4 != 0 // find any that this is *not* 4-aligned
1816
});
1917
assert!(saw_unaligned);
2018

0 commit comments

Comments
 (0)