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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to