From dbe0f1f69ed72140d77ef2dd1175b400fd064cce Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 5 Jul 2019 23:51:11 +0200 Subject: [PATCH] dangling-ptr-to-int should work now --- tests/run-pass/malloc.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/run-pass/malloc.rs b/tests/run-pass/malloc.rs index a50b3f3606..1538232819 100644 --- a/tests/run-pass/malloc.rs +++ b/tests/run-pass/malloc.rs @@ -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);