llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.46k stars 11.76k forks source link

CSA still considers struct return values from messages to nil as being garbage #11562

Open llvmbot opened 12 years ago

llvmbot commented 12 years ago
Bugzilla Link 11190
Version unspecified
OS MacOS X
Attachments Source file that reproduces the warning, CSA output
Reporter LLVM Bugzilla Contributor

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)

llvmbot commented 12 years ago

assigned to @tkremenek