[LLVMbugs] [Bug 7913] New: False positive - Assigned value is garbage or undefined

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 15 07:52:39 PDT 2010


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

           Summary: False positive - Assigned value is garbage or
                    undefined
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: clang-bugzilla at macspice.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5370)
 --> (http://llvm.org/bugs/attachment.cgi?id=5370)
Code exhibiting issue

The attached sample code comprises two versions of a short routine called
'shrink'. They should be equivalent but the second one  produces a false
positive 'Assigned value is garbage or undefined'. Such a warning would make
sense if the value of op->npar was a volatile, but it isn't.

Thanks.

Charles

---------

$ /Developer/usr/bin/clang -v --analyze /Users/X/Documents/clang-bug/main.c -o
foo.html
Apple clang version 1.5 (tags/Apple/clang-60)
Target: x86_64-apple-darwin10
Thread model: posix
 "/Developer/usr/bin/clang" -cc1 -triple x86_64-apple-darwin10.0.0 -analyze
-disable-free -disable-llvm-verifier -main-file-name main.c
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-check-dead-stores -analyzer-check-objc-mem -analyzer-eagerly-assume
-analyzer-check-objc-methodsigs -analyzer-check-objc-unused-ivars
-analyzer-output plist -w -pic-level 1 -mdisable-fp-elim -munwind-tables
-target-cpu core2 -v -resource-dir /Developer/usr/lib/clang/1.5 -ferror-limit
19 -fmessage-length 103 -stack-protector 1 -fblocks -fdiagnostics-show-option
-fcolor-diagnostics -o foo.html -x c /Users/X/Documents/clang-bug/main.c
clang -cc1 version 1.5 based upon llvm 2.7svn hosted on x86_64-apple-darwin10
#include "..." search starts here:
#include <...> search starts here:
 /Developer/usr/lib/clang/1.5/include
 /usr/local/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
/Users/X/Documents/clang-bug/main.c:16:3: warning: Assigned value is garbage or
undefined
                t[i] = s[i];
                ^      ~~~~
1 warning generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list