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

    <tr>
        <th>Summary</th>
        <td>
            Unrelated code has effect on the analysis result of CSA
        </td>
    </tr>

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

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

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

<pre>
    I got a false positive when compiling the following CMVE program:

```c
#include <stdio.h>
int l ;

int *b( int *n) {
  for (; l < 3;)
    return n;
}

int d() {
  int f;
  int *g = &f;
  int *i;
  (i = b(g)) || 1; //instrument_npd103.c:12:4: note: Assuming 'i' is null,  removing "|| 1" would change analysis result;
  printf("NPD_FLAG\n");
  *i;
}

void main() { d(); }
```
Compiling it with options --analyze --analyzer-output text , CSA emits a FP warning as following:

```bash
<source>:15:3: warning: Dereference of null pointer (loaded from variable 'i') [core.NullDereference]
  *i;
  ^
<source>:18:15: note: Calling 'd'
void main() { d(); }
              ^~~
<source>:13:4: note: Value assigned to 'i'
  (i = b(g)) || 1; //instrument_npd103.c:12:4: note: Assuming 'i' is null,  removing "|| 1" would change analysis result;
   ^~~~~~~~
<source>:13:4: note: Assuming 'i' is null
  (i = b(g)) || 1; //instrument_npd103.c:12:4: note: Assuming 'i' is null,  removing "|| 1" would change analysis result;
   ^
<source>:13:4: note: Assuming pointer value is null
  (i = b(g)) || 1; //instrument_npd103.c:12:4: note: Assuming 'i' is null,  removing "|| 1" would change analysis result;
   ^~~~~~~~
<source>:13:3: note: Left side of '||' is false
  (i = b(g)) || 1; //instrument_npd103.c:12:4: note: Assuming 'i' is null,  removing "|| 1" would change analysis result;
  ^
<source>:15:3: note: Dereference of null pointer (loaded from variable 'i')
  *i;
  ^~
1 warning generated.
```
I think it is ok for CSA to report the FP warning, but unrelated code `|| 1` at line 12 can affect the result of analysis: removing this `|| 1 `, the FP disappears. This inconsistency may suggest some problem here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVk2PozgQ_TXkUmrERyDkwCFDukcjzYxG2t25jgwU4BnHRrZJtvfXb9kJSTpKj7a1p44M8QeuevV4uKpW7XP5CXplgUHHhEEYleGW7xEOA0po1G7kgsse7IDQKSHUwY2qL98fYdSq12wXpJsg2gbRfM-jY2tO4yTlshFTixCklbEtV-EQpI_HVS4tCFr4cG3CTQbJpg6SAk59GSRrCFanx4CgaJouaKPfXkHqbCTreR1Ao520BHmxvdreOmmdiZeG3XR33gOz_56cbKmT31njV1NkkPtHHfjeAfLmK2oQO7RB8kSNS2P1tENpf8ixjaM0bIjGOKHbki6QyqL73xgz7RzhQbLidAE3ICchgqRyEe7U_riYnF0kCRzUJFpoBiZ7BCaZeDa0TaOZhL2COmrC33kGkq_ftj-ePm8-BlklnTXCfR3TVYg3LO4Vb2HHuLwwObPqoz0_PaviOKzOuuIWDtwOoEbLlTTw8OAR_4OXnn5Qkx0nCxb_doRXUP2xAdxxa0i2T9_gwLR0tpi5SPQ1VdbMDKcpUqOadINOjER-RrfUkX4y57pb1NjRJRsE1Xnq6Qsh3tDLTyjWYgudVjvYM81ZLXB-VZ6N7EOjNIZfad-VqSDb3uWWhtnjfXDFjPAsjYoJcVJG69y96XXAi5_zuvLtru_0VpXfmZhIWcbwXlL4Vp1jfn9fwVXwN-2_cfEqtndKxRujnj-GvZfEO4_9bTJIr7F9xs6C4a0_JtyX4CGcQPrM-g5JeVUP2W34_--c_M1hOL-A-HzI9yhRM4tteDezfKJKhctfLq9QSOqXrxRcvqBTSuOotPWlzCVrOKJqSi6T1CicXSp6XK1CBmfG8ggYlSlcIsQJNEwC6zpsjpaOrLmoZyIdIWfmCY25Nub75PIEouWGjSMybUL40z1KtRKlQW4scflMR_kzmKnv0ZC61A5dzUXc7WAgssMFlnGeF8tlXKTFoi3Tdp2u2cJyK7D862U8AyVHPKJW0nu_ee8uAuJpMWlRDtaOLoyjFHvKz1MdUi1IAyH2898DgflJBp1aSYVoqJMV6yJfDGUWpwzX6zivi7xdtyxLMK1ZGxOANF8Vy4VgNQpTUoakbLjgZRIlSRzHyziP0qwI07TJV2yJUdYUTV1HwTJCymsidI5DpfuFLj2GeuoNLQpizFwWT7kJZ_tssoPS5UdUXafxOY7i5cJjLj3gfwEs_imD">