[cfe-dev] Static Ananlyze, dead store false positive

Jean-Daniel Dupas devlists at shadowlab.org
Thu Jul 3 12:42:06 PDT 2008


I'm playing with the last static analyzer (I'm always working with the  
svn trunk ;-)) and I'm scanning some of my projects.
I confirm that it is a very valuable tool.

I give you a fase positive (I think it 's one). It says I never read  
values out of keys, but I'm using it twice in the condition.


void DeadStoreTest(NSObject *anObject) {
   NSArray *keys;
  // analyze result: Although the value stored to 'keys' is used in  
the enclosing expression, the value is never actually read from 'keys'
   if ((keys = [anObject exposedBindings]) &&
       ([keys containsObject:@"name"] && [keys  
containsObject:@"icon"])) {
       // do something without keys

   }
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testdead.m
Type: application/octet-stream
Size: 248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080703/1a439029/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080703/1a439029/attachment.bin>


More information about the cfe-dev mailing list