Commit a2f0a013 authored by danno@chromium.org's avatar danno@chromium.org

Fix NULL-pointer arithmetic abuse in tests surfaced by clang

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/12218051

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13614 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9cb3a2e9
......@@ -53,6 +53,7 @@ static void InitializeVM() {
TEST(MarkingDeque) {
InitializeVM();
int mem_size = 20 * kPointerSize;
byte* mem = NewArray<byte>(20*kPointerSize);
Address low = reinterpret_cast<Address>(mem);
......@@ -60,19 +61,20 @@ TEST(MarkingDeque) {
MarkingDeque s;
s.Initialize(low, high);
Address address = NULL;
Address original_address = reinterpret_cast<Address>(&s);
Address current_address = original_address;
while (!s.IsFull()) {
s.PushBlack(HeapObject::FromAddress(address));
address += kPointerSize;
s.PushBlack(HeapObject::FromAddress(current_address));
current_address += kPointerSize;
}
while (!s.IsEmpty()) {
Address value = s.Pop()->address();
address -= kPointerSize;
CHECK_EQ(address, value);
current_address -= kPointerSize;
CHECK_EQ(current_address, value);
}
CHECK_EQ(NULL, address);
CHECK_EQ(original_address, current_address);
DeleteArray(mem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment