clang analyzer reports variable never read if used in block

Originator:me
Number:rdar://10591355 Date Originated:15-Dec-2011 08:37 PM
Status:Closed Resolved:09-Mar-2012 11:16 AM
Product:Developer Tools Product Version:
Classification:Other Bug Reproducible:Always
 
The following code snippet, when analyzed with Xcode's default settings, erroneously marks the first line (NSArray *...) with "Value stored to 'barcodeResult' during its initialization is never read". It is read, but inside the block.

- (void)blah;
{
    NSArray *barcodeResult = [@"849asdf987987" componentsSeparatedByString:@"asdf"];
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{        
        NSString *scannedString = barcodeResult.lastObject;
        if (scannedString && self.scannedBarcodeHandler)
            self.scannedBarcodeHandler(scannedString);
    }];
}


09-Mar-2012 11:16 AM Apple Developer Bug Reporting Team :
Engineering believes this issue has been addressed in the latest Xcode 4.3 release.  Please verify with this release, and update your bug report with the results.  

Xcode 4.3Build: 4E109 (for Lion)
Date posted:  February 16, 2012
https://developer.apple.com/xcode/

Comments


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!