From edd2d9bd0a7f5dbe059aea0902d519b728acc01a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 23 Jan 2013 13:29:12 -0800 Subject: Make the null pointer dereference a volatile one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is to ensure that the compiler won't optimise it out of existence. Clang says it will do it: testProcessCrash/main.cpp:50:5: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] *(char*)0 = 0; ^~~~~~~~~ Change-Id: Iac7771046442f869e205e8789fffdd6443d58e67 Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp index bc8517fe40..e3d5db47dc 100644 --- a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp +++ b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp @@ -47,7 +47,7 @@ struct Foo int main() { - *(char*)0 = 0; + *(volatile char*)0 = 0; Foo *f = 0; return f->i; } -- cgit v1.2.3