Make the null pointer dereference a volatile one
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 <jedrzej.nowacki@digia.com>
bb10
parent
2a3d690a19
commit
edd2d9bd0a
|
|
@ -47,7 +47,7 @@ struct Foo
|
|||
|
||||
int main()
|
||||
{
|
||||
*(char*)0 = 0;
|
||||
*(volatile char*)0 = 0;
|
||||
Foo *f = 0;
|
||||
return f->i;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue