https://bugs.llvm.org/show_bug.cgi?id=12531

Ehud Katz <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #6 from Ehud Katz <[email protected]> ---
(In reply to Jörg Sonnenberger from comment #0)
> 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.

Those loops are not equivalent. The analyzer is correct.
The second loop should have `--i` instead of `++i`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to