Skip to content

Commit

Permalink
Add deallocate calls to the realloc-16687.rs test.
Browse files Browse the repository at this point in the history
Fix #17303.
  • Loading branch information
pnkfelix committed Sep 23, 2014
1 parent 0a4c136 commit ad0cdef
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/test/run-pass/realloc-16687.rs
Expand Up @@ -56,6 +56,13 @@ unsafe fn test_triangle() -> bool {

ret
}
unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
if PRINT { println!("deallocate(ptr=0x{:010x} size={:u} align={:u})",
ptr as uint, size, align);
}

heap::deallocate(ptr, size, align);
}
unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
old_size: uint) -> *mut u8 {
if PRINT {
Expand Down Expand Up @@ -95,10 +102,16 @@ unsafe fn test_triangle() -> bool {
}

sanity_check(ascend.as_slice());
test_1(ascend);
test_2(ascend);
test_3(ascend);
test_4(ascend);
test_1(ascend); // triangle -> square
test_2(ascend); // square -> triangle
test_3(ascend); // triangle -> square
test_4(ascend); // square -> triangle

for i in range(0u, COUNT / 2) {
let size = idx_to_size(i);
deallocate(ascend[2*i], size, ALIGN);
deallocate(ascend[2*i+1], size, ALIGN);
}

return true;

Expand Down

11 comments on commit ad0cdef

@huonw
Copy link
Member

@huonw huonw commented on ad0cdef Sep 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at pnkfelix@ad0cdef

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fix-17303 = ad0cdef into auto

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fix-17303 = ad0cdef merged ok, testing candidate = b57f571f

@pnkfelix
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at pnkfelix@ad0cdef

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fix-17303 = ad0cdef into auto

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fix-17303 = ad0cdef merged ok, testing candidate = 0c66796

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on ad0cdef Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 0c66796

Please sign in to comment.