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

    <tr>
        <th>Summary</th>
        <td>
            clang static analyzer: `error()` masks NULL dereference
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          251
      </td>
    </tr>
</table>

<pre>
    For the following program:
```C
#include <error.h>
#include <stddef.h>

int main(int argc, char * argv[]) {
        int *p = NULL;

        if (argc > 2) {
                error(0, 1, "test: %s", "foo");
                int ret = *p;
                return ret;
        }
}                                                                                                                        
```
the null-deref is missed as soon as I add the call to `error()`. Given that the first argument to `error` is `0`, it does not call `exit` and the program crashes (`./a.out 1 2`). Does the analysis just give up here or is the model for `error` incorrect?

(Tested with **LLVM 14.0.6**.)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFU02PmzAQ_TXmMloE5iNw4LCbbKpKaU9t78Y24K1jR7bJdvvrO4ZETaLeiwz-mOeZx8yb3oqPbm8dhEnCYLW278qMcHJ2dOxIimeS7Uj2TOpsHdvLnhbKcD0LCaTYSuesSydSvP7L6oMQcrg1L19lAhyZMoQ2ccncyAndAp-YA0Kf48GZVC-k2hHaAtm8XC-3EY6IEzrfwdfvhwMpXm49R8iAiCb6RNAr0EcXOBbSCMpi1Dx-CKVB-oA_jcvK4_ZyOli7bNqbQO2FiJNh4REJPZjRNDsTEXeGze6y3uzgPz0PRV23UQFm1vpJSCcHUB6OynspgHnw1po4fwYmxKIVzrSGYAGvXzMZE1RnKXxSZ2kQxMKqKuX8Ut_5KDFht3fqLIbBaWGByVYBhJUejA1rhAj9pUJEMrNGvmgTuGN-QmyMjGEJ3bPUzgFyLHf01qawi77iHWaY_vAY621GLiMShPkEE_4ooPbVCjpaITU2gbsnaLh1TnIs4v5OZbT5hmrB_LyrMMX64zgcfnyBvEyztF4PkFabiK4QbdGyJKigZcc1wxbzgQXFV2a_pVtU95hLbBD_0y8ah6Uq-Bouk9npbgrh5GOD0j2OETnMfcrtETdan6_TE2brLZKneyzmLFHV-6quyiaZurzvG1FvGsaaYlPVfdnzuhwGSWuZDbSQiWa91L5buzBRHc0ozTZ5lVdZVdRp2_OStrQYeNlWQ8lImUnsaJ3GwKl1Y-K6hUM_jx6NWvng_xqZ92o0Ul79szlM1nW0ypOFarfw_AM75kwa">