[LLVMbugs] [Bug 11190] New: CSA still considers struct return values from messages to nil as being garbage

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 20 04:42:28 PDT 2011


           Summary: CSA still considers struct return values from messages
                    to nil as being garbage
           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: macbavarious at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=7488)
 --> (http://llvm.org/bugs/attachment.cgi?id=7488)
Source file that reproduces the warning

Greg Parker has recently announced on Twitter that the Objective-C runtime now
zeroes out structs that are return values when a message is sent to nil:


‘With the LLVM Compiler and Xcode 4.2, struct-returning messages to nil now
return a zero-filled struct instead of an undefined struct value.’

However, CSA checker-258 still thinks that garbage is returned in this

‘The receiver of message 'xxx' is nil and returns a value of type 'yyy' that
will be garbage’

I’m attaching a sample program that reproduces this analyser warning as well as
the analyser output. I’m using stock Xcode 4.2 clang and CSA checker-258.

$ clang --version
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix

$ /usr/local/checker-258/scan-build
USAGE: scan-build [options] <build command> [build options]

ANALYZER BUILD: checker-258 (2011-10-13 20:54:07)

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