Index: base/tools_sanity_unittest.cc |
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc |
index 249ec71946a568bc3f20f289c4135008d1b7ca11..ec7b1cc93949f889d1d92348782fb5d1c788ff4a 100644 |
--- a/base/tools_sanity_unittest.cc |
+++ b/base/tools_sanity_unittest.cc |
@@ -74,7 +74,8 @@ void MakeSomeErrors(char *ptr, size_t size) { |
// A memory leak detector should report an error in this test. |
TEST(ToolsSanityTest, MemoryLeak) { |
- int *leak = new int[256]; // Leak some memory intentionally. |
+ // Without the |volatile|, clang optimizes away the next two lines. |
+ int* volatile leak = new int[256]; // Leak some memory intentionally. |
leak[4] = 1; // Make sure the allocated memory is used. |
} |