Index: base/tools_sanity_unittest.cc |
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc |
index 4804a35a3b9ef95cec9db0327982fd394b6da30a..c763a32a53159b0aa1a5a22cf5942a3c0d83eef6 100644 |
--- a/base/tools_sanity_unittest.cc |
+++ b/base/tools_sanity_unittest.cc |
@@ -32,17 +32,26 @@ const base::subtle::Atomic32 kMagicValue = 42; |
do { if (RunningOnValgrind()) { action; } } while (0) |
#endif |
-void ReadUninitializedValue(char *ptr) { |
+void DoReadUninitializedValue(char *ptr) { |
// Comparison with 64 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 == 64) { |
- (*ptr)++; |
+ VLOG(1) << "Uninit condition is true"; |
Nico
2014/01/15 17:46:18
why this change?
|
} else { |
- (*ptr)--; |
+ VLOG(1) << "Uninit condition is false"; |
} |
} |
+void ReadUninitializedValue(char *ptr) { |
+#if defined(MEMORY_SANITIZER) |
+ EXPECT_DEATH(DoReadUninitializedValue(ptr), |
+ "use-of-uninitialized-value"); |
+#else |
+ DoReadUninitializedValue(ptr); |
+#endif |
+} |
+ |
void ReadValueOutOfArrayBoundsLeft(char *ptr) { |
char c = ptr[-2]; |
VLOG(1) << "Reading a byte out of bounds: " << c; |