diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-18 16:39:12 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-18 16:39:12 +0000 |
commit | 83a13b2018c85e9a6e57edcc6868d0d5061f4acb (patch) | |
tree | cdc559b34ca0decda37c8da50e9ea4e0accff857 /base | |
parent | 030bae9e5a877394613b2aa671f4148713d5e2ae (diff) | |
download | chromium_src-83a13b2018c85e9a6e57edcc6868d0d5061f4acb.zip chromium_src-83a13b2018c85e9a6e57edcc6868d0d5061f4acb.tar.gz chromium_src-83a13b2018c85e9a6e57edcc6868d0d5061f4acb.tar.bz2 |
mac: Try to fix valgrind sanity tests 14 and 15.
See http://code.google.com/p/chromium/issues/detail?id=96945#c4
Not the nicest patch, but it's what we get for writing tests that
explicitly rely on undefined behavior with optimizations enabled.
BUG=96945
TEST=valgrind sanity tests 14 and 15 go green on the mac memory bot
Review URL: http://codereview.chromium.org/7931012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/tools_sanity_unittest.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc index 661b58e..bbcb3e5 100644 --- a/base/tools_sanity_unittest.cc +++ b/base/tools_sanity_unittest.cc @@ -15,7 +15,10 @@ namespace { const base::subtle::Atomic32 kMagicValue = 42; void ReadUninitializedValue(char *ptr) { - if (*ptr == '\0') { + // The || in the conditional is to prevent clang from optimizing away the + // jump -- valgrind only catches jumps and conditional moves, but clang uses + // the borrow flag if the condition is just `*ptr == '\0'`. + if (*ptr == '\0' || *ptr == 64) { (*ptr)++; } else { (*ptr)--; |