summaryrefslogtreecommitdiffstats
path: root/base/process_util_unittest.cc
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:53:36 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:53:36 +0000
commit339651d588733a950864e7cac566b614421ca9cd (patch)
treebca7fef2561155ac8c3b9096aded01887a51e0ae /base/process_util_unittest.cc
parent7c1490dad18464a5ae6f748cbf645ff7fca4a108 (diff)
downloadchromium_src-339651d588733a950864e7cac566b614421ca9cd.zip
chromium_src-339651d588733a950864e7cac566b614421ca9cd.tar.gz
chromium_src-339651d588733a950864e7cac566b614421ca9cd.tar.bz2
Fix Clang-built ProcessUtilTest.GetTerminationStatusCrash.
Writing to a NULL pointer is undefined behaviour, and unless that pointer is volatile, Clang will optimize it away, replacing it with an UD2 instruction which causes the process to die by SIGILL. This patch makes the pointer volatile, so the write occurrs, and the process dies with SIGSEGV as intended. BUG=68707 TEST=build with Clang, out/Release/base_unittests --gtest_filter=ProcessUtilTest.GetTerminationStatusCrash Review URL: http://codereview.chromium.org/8233010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_unittest.cc')
-rw-r--r--base/process_util_unittest.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index fcd65a5..08a1fb2 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -192,7 +192,7 @@ MULTIPROCESS_TEST_MAIN(CrashingChildProcess) {
::signal(SIGSEGV, SIG_DFL);
#endif
// Make this process have a segmentation fault.
- int* oops = NULL;
+ volatile int* oops = NULL;
*oops = 0xDEAD;
return 1;
}