diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-18 16:30:12 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-18 16:30:12 +0000 |
commit | 014b0b06063045c58cf781bbb0d6c719572f1a71 (patch) | |
tree | 4c8cfe0059a09df8516870c9adf202f786553171 /base/tools_sanity_unittest.cc | |
parent | 43e753ca18883f574289b40f9e99aeeb0fa3eff2 (diff) | |
download | chromium_src-014b0b06063045c58cf781bbb0d6c719572f1a71.zip chromium_src-014b0b06063045c58cf781bbb0d6c719572f1a71.tar.gz chromium_src-014b0b06063045c58cf781bbb0d6c719572f1a71.tar.bz2 |
Prevent clang from optimizing away 2 variables.
Hopefully fixes Memcheck sanity tests 12 and 13.
BUG=96945
TEST=none
Review URL: http://codereview.chromium.org/7931006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/tools_sanity_unittest.cc')
-rw-r--r-- | base/tools_sanity_unittest.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 64a9ca6..661b58e 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc @@ -84,7 +84,8 @@ TEST(ToolsSanityTest, ArrayDeletedWithoutBraces) { if (!RunningOnValgrind()) return; - int *foo = new int[10]; + // Without the |volatile|, clang optimizes away the next two lines. + int* volatile foo = new int[10]; delete foo; } @@ -93,7 +94,8 @@ TEST(ToolsSanityTest, SingleElementDeletedWithBraces) { if (!RunningOnValgrind()) return; - int *foo = new int; + // Without the |volatile|, clang optimizes away the next two lines. + int* volatile foo = new int; delete [] foo; } |