[cfe-users] UB Sanitizer false positive

James Walker via cfe-users cfe-users at lists.llvm.org
Fri Nov 2 17:39:00 PDT 2018

Writing for Mac Cocoa in Objective-C, I have a subclass of NSApplication 
that overrides sendAction:to:from:.  The override often ends up calling

[super sendAction: anAction to: aTarget from: sender]

and when aTarget is nil, UB Sanitizer says "Null pointer passed as 
argument 1, which is declared to never be null".  Yet the declaration in 
the NSApplication header (and in my subclass) is

- (BOOL)sendAction:(SEL)action to:(nullable id)target from:(nullable 

so it should be fine for the target argument to be nil, assuming that's 
the one it means when it says "argument 1".  I thought maybe the 
compiler wasn't sure about the type of "super", so I tried casting it to 
NSApplication*, but that's not allowed.  Am I missing anything?

More information about the cfe-users mailing list