<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVE2P2jAQ_TXhYhGFALtwyGG7KyTulXqsJvYkuOt4In-wpb--Yyehy14rIVDw-L15782kJXVrzlYMNyFJoSAr8IqOn27S8GMnQPSGWjDCEI3iLDrtfBCjwxEc8qnR_Mh1H3rdaaFtQNeBRC_CBQLXf4ANIpCgER0E5LpwKepXAVZxCVrhItNHE_SYCHOVJutzYaoYSkaJHu99zISfqDpywlKmGcH7fEuA5-64SRiQC7l8VtZFKxNDKb5ftJ_gbDoS8gK2ZzgVnbY9e4EP2rMln2_xLxhP4idz_xQKpWFLVCK-kmEVrKeoD0kow1uhuefAfvgk37Ij3KbjXh2CunPrUNTHsqjeiupl-v4x-egRE6GNAzqKrJmpcT2S10FfUaBz5LyQwE4p0XKAhgHXYMHc_jAN2xKHMemegglJxWdHJUWztLE4gL9RxnyH_U52eP6XVS0WJiFZWrhQ7C8T6HL4xdSw2MZx2pRL0DKyYQnjPBn8GSX3xHmCMSTT3HgaUAw4EEfIQzInEHBIAHmQzkLRVCbBJOw8R-nYG8QxT8mGfZRkVfqXq28YeBCnIL5eug_o3Jubm8OJGnrgkeIOO8fJLG2qucVSvCb_J9uXZch30fY81-znHenB-cTKu0Uu-EWtQXjn6H3Ex7lI-zGlHIiMXz-VVQJ105zQNBJJSRu53ZBwmK1zNDxc21SZtMUbTYqniwmEt9yjDeVKNVt13B5hBZFDco1_txAHuq6iM80lhNEX25eiPvGn57ZiW0riYE7GXJef9ejoF0oe71PWwh6f9tvjc7W6NJvdvt49VwdVdW2t1PNu2x4AOmjbp0N72KuVgRaNb4r9t2L_tvp_St3UVZ0-m82mrnb78sj07VEeqr2Eg8JDsatwAG3KhFOS61euyZBt7D0fpuD8v0OOWfcWcekw6GCwmUfgYQWXWZhX7wpOQ8srdQUT8b4s_NrQYYoxvQ9yQD3a_AadV198Wf1VlthkfX8BDI0O0Q>53970</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang analyzer assumes that global variable value changes (it is not) and generates false positive errors
        </td>
    </tr>

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

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

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

<pre>
    In my code on every cycle of a global loop I first prepare a list of wi-fi interfaces that I want to operate with, and then run multiple operations with them. I use global list of interfaces for not to pass them as a parameter in every function. This list never changes during one global loop cycle. This list is also _not_ declared as volatile (and even if it was, no other thread changes it).

What I see is numerous false-positive errors caused by clang-analyzer assumption that this global list could change during execution of one single function, even though this function never changes this list. In particular, I loop though this list to allocate some memory per list item, then I do some calculations, sleep for 1 second, do yet another calculations, and then loop through the list again to free allocated memory. Clang assumes that the length of the list could change and reports memory leak issue.

With clang-tools-6.0 there is no error, but at least from clang-tools-10 and beyond the error is present.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxdVEtvozAQ_jVwsYLIqw0HDt1WkXJfaY_VYAbw1niQH-lmf_2ODWSbSijIeDzfYz6nofZWX4wYb0JSi4KMwCtaXt2k5mUnQPSaGtBCE03iIjplnReTxQks8q5WvOS6T7XplFDGo-1AohN-AM_1n2C88CRoQgseuc4P2e5VgGm5BI2wgeGD9mqKgKlKkXGpMFaMBXcJDu88FsAvUB1ZYSjBTOBcOiXAMTsmCSNyIZcvyrpgZEQoxM9BubmdiVtCDmB6btcGq0zPXuCD9mTJ11P8Bu1IvDP2u2hRarakjcBX0qyC9WS7UxTK7Y1QzNmzHy7KN-wI07TM1SK0d2zls11VZOVbVr7Mv79mHx1iBDRhREuBNTM0biZyyqsrCrSWrBMS2KlWNDxAzQ03YEDf_jIM2xLGKeqeB-Ojiq-OSgp6pbE6gH9QhnSG_Y52OP7KqlYLo5AkzQ8U-mFuum5-M9WvtvE4TZyLVzKwYbHHZTb4a5fEiecJWpOMuXE0ohhxJB4hh2SZgMcxNkhBuoiW5jIJOvZOOYrbTiNOKSVb9lGSaeNXrr6h5yDOg_h-6B7QhZtdyOEMDT1wpJhhZ3kyK812oViI1-j_bPt6GdJZND3nmv28d3pwPqLy3SLr3apWI3zw6F3Ax1zE-zFP2RNpt3kqytjUzjmhORJRSROYro99GK2zND4c25YJtMEbzYrng7EJ33KHxhd5W-_bal9B7pXXWC_aHrK1ilwydQWroOGsXEEHvKeA74PyM78Y9ITco0l_DUumxbdM58HqevB-ctn-Jdud-elZemgKSTz8s9bX9bWZLP1GyZ3PyS-e4_m4r57LfKibqt1Wh67ZV9iVZSXbIzyd9vj03J0Op-0Wcg0Naldnxx_Z8S1X9a7cxWe73e7Kw7GoDs9lU8lTeZRwavGUHUocQekiAhdk-9zWiUMTesebcbTu_yZ7pHqDuPaHwGm3tfswEEa65olvncj-Aw9d-QI">