<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60026>60026</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang static analyzer] core.NullDereference false positive with `*r = 42`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          0-0x41
      </td>
    </tr>
</table>

<pre>
    I got a false positive error when compiling the following program with clang(trunk) `--analyze -Xclang -analyzer-stats -Xclang -analyzer-checker=core,debug.ExprInspection` https://godbolt.org/z/Pae9xqrWT.

In this case, the eval result on line 17 is TRUE, and apparently analyzer is known to fact that the result of `(-g.e.b && g.e.c)` is FALSE, yet it continues to do analysis of the code inside the if statement, which is unreachable code.

Here is the analysis result of the case. Thank you for taking the time to review this case.

Input:

```c
#include "stdio.h"
#include <stdbool.h>
void clang_analyzer_eval();

struct a
{
    int b;
    int c;
};

union d
{
    struct a e
} main()
{
    union d g = {};
    int *r = (int *)0;
 clang_analyzer_eval((-g.e.b && g.e.c) == false);
    if (-g.e.b && g.e.c)
    {
        *r = 42;
 }
}

```

Output:

```bash
<source>:17:5: warning: TRUE [debug.ExprInspection]
    clang_analyzer_eval((-g.e.b && g.e.c) == false);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:20:12: warning: Dereference of null pointer (loaded from variable 'p') [core.NullDereference]
        *p = 42;

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVU9v6zYM_zTyhYihSLEdH3xImwYrMGzD1mG7PcgybWtVJE-Sk_Yd9tkHOX-blw4Y8IoiiUjqR_JHihTeq84gViR7INk6EWPoravojL4t5kltm_fqGTobQEArtEcYrFdB7RDQOetg36MBabeD0sp0EHqE1mpt9_E0ONs5sYW9Cj1ILUxH2DK40bwSVgLJ6WwmjNDv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