<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:ehudkatz@gmail.com" title="Ehud Katz <ehudkatz@gmail.com>"> <span class="fn">Ehud Katz</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Reverse loop order with variable upper boundary not handled correctly by analyzer"
   href="https://bugs.llvm.org/show_bug.cgi?id=12531">bug 12531</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>ehudkatz@gmail.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Reverse loop order with variable upper boundary not handled correctly by analyzer"
   href="https://bugs.llvm.org/show_bug.cgi?id=12531#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - Reverse loop order with variable upper boundary not handled correctly by analyzer"
   href="https://bugs.llvm.org/show_bug.cgi?id=12531">bug 12531</a>
              from <span class="vcard"><a class="email" href="mailto:ehudkatz@gmail.com" title="Ehud Katz <ehudkatz@gmail.com>"> <span class="fn">Ehud Katz</span></a>
</span></b>
        <pre>(In reply to Jörg Sonnenberger from <a href="show_bug.cgi?id=12531#c0">comment #0</a>)
<span class="quote">> Consider this code:

> void f(int j)
> {
>         void *buf[j];
>         int i;
>         if (j < 0)
>                 return;
>         for (i = 0; i < j; ++i)
>                 buf[i] = malloc(100);
> #if WORKING
>         for (i = 0; i < j; ++i)
> #else
>         for (i = j - 1; i >= 0; ++i)
> #endif
>                 free(buf[i]);
> }

> The two for loops in the #if are equivalent, but the second triggers the
> "use of potentially uninitialised memory" check.</span >

Those loops are not equivalent. The analyzer is correct.
The second loop should have `--i` instead of `++i`.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>