diff options
Diffstat (limited to 'base/tools_sanity_unittest.cc')
-rw-r--r-- | base/tools_sanity_unittest.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 249ec71..ec7b1cc 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. } |