[LLVMbugs] [Bug 14010] New: Warnings are inappropriately suppressed when -fobjc-gc is enabled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 3 14:15:02 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=14010

             Bug #: 14010
           Summary: Warnings are inappropriately suppressed when -fobjc-gc
                    is enabled
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jalkut at red-sweater.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9301
  --> http://llvm.org/bugs/attachment.cgi?id=9301
Example source file demonstrating the failure to generate expected warnings
when -fobjc-gc is supplied.

I confirmed this bug against trunk as of this afternoon.

Code that would normally trigger atomic-property-with-user-defined-accessor
warnings has those warnings inhibited if compiled with -fobjc-gc.

Assuming the warnings were being inhibited on purpose because the atomicity
could be guaranteed in a GC environment, it would still not be appropriate to
inhibit when -fobjc-gc is supplied because the compiled code may still run in a
non-GC environment.

As far as I can tell the warning is being inhibited even when the code is
unsafe in GC.

Attached is a simple example that demonstrates the bug. Compile with -fobjc-gc
and get no warnings:

Macho% ./Debug+Asserts/bin/clang -fobjc-gc -framework Foundation -o
AtomicGarden AtomicGarden.m
Macho% 

Compile with and get the atomic accessors warning:

Macho% ./Debug+Asserts/bin/clang -framework Foundation -o AtomicGarden
AtomicGarden.m            
AtomicGarden.m:13:1: warning: writable atomic property 'myRect' cannot pair a
synthesized getter with a user defined setter
[-Watomic-property-with-user-defined-accessor]
- (void) setMyRect: (NSRect) myRect
^
AtomicGarden.m:13:1: note: setter and getter must both be synthesized, or both
be user defined,or the property must be nonatomic
AtomicGarden.m:6:35: note: property declared here
@property (atomic, assign) NSRect myRect;
                                  ^
1 warning generated.

-- 
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