Regression: clang static analyzer emits spurious warning when releasing strong ivar in -dealloc

Originator:twiomood
Number:rdar://20140181 Date Originated:12-Mar-2015 11:53 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.3 beta 3
Classification:Other Bug Reproducible:Always
 
Summary:
Regression: clang static analyzer emits spurious warning when releasing strong ivar in -dealloc

Steps to Reproduce:
Compile the attached sample.
This has a "nonatomic,readonly" property and is using MRR.


Expected Results:
The -dealloc method should be able to call -release on its ivars.

Actual Results:
A spurious warning is emitted:

readonly-property-analyzer.m:20:2: warning: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
        [_string release];


Version:
Xcode 6.3 beta 3

Notes:
This warning goes away if you explicitly mark the property 'strong', but since it is object typed, this should be the default.

The scary part is wondering if the compiler itself is broken in some cases in ARC mode and doesn't strongly retain 'readonly,nonatomic' properties when assigned.

Configuration:


Attachments:
'readonly-property-analyzer.m' was successfully uploaded.

https://gist.github.com/tjw/b69773a1e0950a3be4ee

Comments

Actually, it is a bit worse. If your property is of type CFStringRef, you can't mark it 'strong' to work around the problem.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!