[LLVMbugs] [Bug 22726] New: False positive on loop with complex condition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 27 07:12:05 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22726

            Bug ID: 22726
           Summary: False positive on loop with complex condition
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: rino4work at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13957
  --> http://llvm.org/bugs/attachment.cgi?id=13957&action=edit
False positive case

Analyzer reports garbage for initialized variable:

clang --analyze -Xanalyzer -analyzer-output=text source.c
source.c:18:18: warning: The left operand of '!=' is a garbage value
    if(result[i] != 0)
       ~~~~~~~~~ ^
source.c:6:14: note: Assuming 'i' is >= 'count1'
  for(i = 0; i < count1; i++)
             ^~~~~~~~~~
source.c:6:3: note: Loop condition is false. Execution continues on line 11
  for(i = 0; i < count1; i++)
  ^
source.c:11:3: note: Loop condition is false. Execution continues on line 16
  for(i = count1; i < count2; i++)
  ^
source.c:16:3: note: Loop condition is true. Entering loop body
  for(i = 0; i < count1 + count2; i++)
  ^
source.c:18:18: note: The left operand of '!=' is a garbage value
    if(result[i] != 0)
       ~~~~~~~~~ ^
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150227/536b6bcc/attachment.html>


More information about the llvm-bugs mailing list