<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62232>62232</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang static analyzer] core.NullDereference false negative with `*p = 1024`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hallo-wereld
</td>
</tr>
</table>
<pre>
version: Clang trunk
args:
```shell
--analyze -Xclang -analyzer-stats -Xclang -analyzer-checker=core,debug.ExprInspection --analyzer-output text
```
This case reports `core.NullDereference`.
```c
int foo(int t)
{
if (!t)
{
int *p = (void *)t;
*p = 1024;
}
}
```
This case doesn't report `core.NullDereference`.
```c
int foo(int t)
{
t = t + 1;
if (!t)
{
int *p = (void *)t;
*p = 1024;
}
}
```
See it live:
https://godbolt.org/z/j8nMonozq
https://godbolt.org/z/Yzhdb7KEx
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VM9vnDoQ_muGi8XK2LuwHDgkIUhPT-9d2kN7NGYAJ45NbbNJ9q-vDLtFiVK1h3a1Mvbnb358wwzCezUYxAoOt3CoEzGH0bpqFFrb9Bkd6i5pbfdandB5ZQ3wG3KnhRlIcLN5BFoDvRFu8PFiPUFO178fUesVS1NhhH49I0m_yMX8CrjUBxH8B7gcUT6iA15L6xDYXYftPOzuXyb3j_ETyqCsIelmYOcwzYEEfAnvMrkcl_XzqDyRwiNxOFkXPIGcxgi7_2eta3TYo0MjEXK6e-dHrmdlAumtBXaMuwCsvPCK23VDCCGqJ8COwLLtPsJvOAvPBALsZiLA62hxsqqLALAyAL-SfzAyyvYbvDisr9HrD2VvgjuL3gArwkX6X1IelkSjqluSbbn-2YJcfj-pyy-Lsq6fEIkKRKsTbv07hjDFdgbWAGsG27VWh511A7DmDKx5OJr_rLHnb79H_3oeu7b49_4l6SrelbwUCVZZfsyOJadZnowVzfq26FtZlHnRy4Og8sD32KHkXbvveJ-oilHG6T4r6THa7DrOM1kWRXvI94c-o7Cn-CSU3ml9eoqxE-X9jFXOGGeJFi1qv0w4YwafyXIJjMWBd1W0Sdt58LCnWvngNy9BBb18GtbZjJOqJLkOHBxq8lH7kF5oj8TgIII6IXlWYYyt9vZd5TSZna7elU-FcW530j4Ba2Ial0c6OfuAMgBrluQ9sGYR9z0AAP__KR5aHw">