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

    <tr>
        <th>Summary</th>
        <td>
            Analyzer fails to give warning on accessing pointer after the end of the scope .
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:static analyzer
      </td>
    </tr>

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

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

<pre>
    Problem - 
`#include <iostream>
int main() {
  int size = 3;
  int* ptr = nullptr;
  {
    int arr[size];
    arr[0]=33;
    arr[1]=444;
    arr[2]=32;
    ptr = arr;
  }
  for(int i=0; i<size; i++){
   std::cout << ptr[i] << " ";
  } 
}` 

`ptr` have access to `arr` till the end of the second scope, but after that it looses the accessibility over `arr` , analyzer should warn on this ,that use of the pointer `ptr` become invalid after the scope. But ig this seems like the general problem inside the static analyzer that currently it is not able to detect the scopes in the control flow graph and it deals with(https://godbolt.org/z/Mj58MKo4q) and without (https://godbolt.org/z/Th1ox6zeo)scopes as similar , you can see that both are producing the same CFG . 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFVE2P2yAQ_TX4gjayIXHigw_56PZQrdRD_wCGsc0uMSngbJNf3wHHTXa1UiWsMMzM4828IY1Vl_qns42BI32iJD-QfEvKnDCuB2lGBZTwvbY-OBBHwr9NEXoI9Cj0QNiGsIqS9W46pzR6vL7GtAPlhD86CNvSU3DJNYzG4P4h4AFkghHOkdUugpHV4SGQ3jx5Oj5w_oWvmHzL5fILJ7slsg--mVmMeWR1mLetdVhvZKYxLseguNkngmnPdmlVj5X4oAjf4pJ2DLGXuOJVSEMjjfmEMBa_jxfPciCFMp-NWaGIgae9OAMVUoL3NFiKR5E_OoI2hoYeKAyK2jZtPUiLlpf2BITtaYOURBvAoVdgWYEaaz34FDyB6kYbHS7UnjHqjh6zxSDM5YrHvrejUfRduIHaAZO1jwEJc_Qw336y2LsJ5Ua-QT5HQLHPwmj1jwpMDBd0h_x0NwF6gKOnRr9BiuhgACcMPd1mVw9eq8nlgwha3uklHnJ0DoZgLrFKhBsslo6ZsWkKAshwv9gjWrKwW8FZQ1tj32nnxKlHVBURFAjj6bsOPY5EH8LJR5XZM67OqsaasLCuQ-uK38vravPywy5_x7cSAWJeGof_5_7qC_unvILF3Bs5gc3QR22ESzJc7EilGGKDplIbG5Cng9gbNUo9dFNpAlu9f_5OFzSDuihXFSvyslxmquaq4pXIgg4G6u3ct1Zok4aq0zhjUd0IhQLfJgONWdK7co_TFunSRTY6U38qE-sfmwWKj4Yx5_nnCRm_ohRoau9H8LhZlRvGs75uqo1qWNkouSlK1lQF422ebyQUOQO-3mRGNGB8jQ8LH5I0Yujwvk-zEJ_Y6pDpmuWM5WueF9WqyPmiWap1U_CqXco2V1yRZQ74_2YWkVVUI3N1ItiMnUen0T74u1NgN7oBIF2O-GJEfV196i87J-QbBJ-leupUzF_DWbBo">