Index: base/allocator/allocator_shim_unittest.cc |
diff --git a/base/allocator/allocator_shim_unittest.cc b/base/allocator/allocator_shim_unittest.cc |
index e1a7f53874ea6e472f34d3cbac1c80ae00061e85..776263f91d9f5fa55d2bc9e2e56c34a89147d850 100644 |
--- a/base/allocator/allocator_shim_unittest.cc |
+++ b/base/allocator/allocator_shim_unittest.cc |
@@ -158,7 +158,9 @@ class ThreadDelegateForNewHandlerTest : public PlatformThread::Delegate { |
void ThreadMain() override { |
event_->Wait(); |
- void* res = realloc(reinterpret_cast<void*>(0x42ul), 1); |
+ |
+ // volatile to ensure the compiler doesn't optimize away the equality check |
+ void* volatile res = realloc(reinterpret_cast<void*>(0x42ul), 1); |
EXPECT_EQ(0x42u, reinterpret_cast<uintptr_t>(res)); |
} |