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 situation:
‘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
Extended Description
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:
https://twitter.com/#!/gparker/status/126504686583939072
‘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 situation:
‘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 options]
ANALYZER BUILD: checker-258 (2011-10-13 20:54:07)