Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: test/cctest/test-mark-compact.cc

Issue 12218051: Fix NULL-pointer arithmetic abuse in tests surfaced by clang (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index 48610b09acf78e8781ee07580f4c02531e50eb94..d94c37e808ff8a72fa889b3e95e238353296a4f5 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698