[LLVMbugs] [Bug 14765] New: False positive: Assignment to struct causes garbage value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 31 13:03:49 PST 2012


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

             Bug #: 14765
           Summary: False positive: Assignment to struct causes garbage
                    value
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: jalkut at red-sweater.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9782
  --> http://llvm.org/bugs/attachment.cgi?id=9782
Example source file showing the false positive scenario.

Clang from SVN 171306.

I hope this isn't a duplicate. I see some similar reports but I don't think
they capture the specific nuance of what I'm seeing.

In summary: clang complains about a garbage value from a struct if a
neighboring field in the struct has been assigned e.g. a CGRect value.

I'm attaching a source file that demonstrates the issue with a clang built
today. See comments above each of "testClang", "testClang1" and "testClang2"
for more specific details.

admins-MacBook-Pro% ~/bin/clang-latest/bin/clang --version       
clang version 3.3 (trunk 171306)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

admins-MacBook-Pro% ~/bin/clang-latest/bin/clang --analyze Test.m
Test.m:18:20: warning: The left operand of '>' is a garbage value
        if (testObj->size > 0.0) { ; }
            ~~~~~~~~~~~~~ ^

-- 
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