[llvm-bugs] [Bug 25259] New: Objective-C compiler and static analyzer fail to warn about properties to objc-object that are 'assign' instead of 'weak' / 'strong'

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 20 07:03:50 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25259

            Bug ID: 25259
           Summary: Objective-C compiler and static analyzer fail to warn
                    about properties to objc-object that are 'assign'
                    instead of 'weak' / 'strong'
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mayer.julian at googlemail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

i just lost 3 hours in a complicated debug session because one of the
properties in my project was assign:
@property (nonatomic, assign) NSArray *fontFamilyNames;
instead of strong:
@property (nonatomic, strong) NSArray *fontFamilyNames;

since the object was used in cocoa bindings but actually deallocated this
resulted in a strange crash somewhere deep inside Apple's frameworks, and only
'malloc_history' was able to show the culprit.

i can not understand why no warning was triggered, despite using -Wall
-Weverything and running the static analyzer

using Apple LLVM version 7.0.0 (clang-700.0.72)


i'm not the only one wishing this would result in a warning:

http://stackoverflow.com/questions/31880445/xcode-warning-if-using-assign-attribute-for-reference-types-objects


i guess not only assign but 'unsafe unretained' should also warn

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151020/494ad134/attachment.html>


More information about the llvm-bugs mailing list