summaryrefslogtreecommitdiffstats
path: root/base/tools_sanity_unittest.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 11:08:09 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 11:08:09 +0000
commit6bfad0e644a71f527292ea245f0582d073831de3 (patch)
tree2135535c35cc031fb7e319837edc7e6ebe953eaf /base/tools_sanity_unittest.cc
parent9800c577138cecb807dbb412c148db63f8cb8afb (diff)
downloadchromium_src-6bfad0e644a71f527292ea245f0582d073831de3.zip
chromium_src-6bfad0e644a71f527292ea245f0582d073831de3.tar.gz
chromium_src-6bfad0e644a71f527292ea245f0582d073831de3.tar.bz2
Prevent clang from optimizing away a variable.
It looks like clang recently learned how to optimize away more stuff. This should hopefully fix Memcheck sanity test 1. BUG=102355 TEST=Bots on the memory.fyi waterfall go green Review URL: http://codereview.chromium.org/8429008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/tools_sanity_unittest.cc')
-rw-r--r--base/tools_sanity_unittest.cc3
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.
}