<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 19, 2008, at 5:40 PM, Nikita Zhuk wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">First I would like to express my appreciation for the great static  <br>analyzer, which is already producing useful results. I've been able to  <br>find several memory leaks and some dead stores.</span></blockquote><div><br></div><div>That's wonderful to hear!</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "> However, I would like  <br>to address an issue which produces some dead store reports which are  <br>technically correct (they really are dead stores), but I would still  <br>like to ignore them.<br><br>When I allocate an object (by using alloc & init* or one of the  <br>*Create* functions) and store it into a local variable inside some  <br>scope, I tend to set it to nil/NULL after the object has been  <br>released. This is an intentional dead store, which prevents any use of  <br>that released object later in the same scope.</span></blockquote></div><br><div>I agree, the dead store checker is meant to find bugs, not penalize defensive programming.  The following patch causes dead assignments of null to pointers to not be treated as warnings:</div><div><br></div><div>  <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080616/006188.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080616/006188.html</a></div><div><br></div><div>checker-42 (on the clang website) includes this patch.  If you find cases where this fix doesn't handle all cases, please let me know.</div><div><br></div><div>Ted</div></body></html>