<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Feb 17, 2013, at 11:25 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">On Sun, Feb 17, 2013 at 11:18 PM, Ted Kremenek<span class="Apple-converted-space"> </span></span><span dir="ltr" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; float: none; display: inline !important;"><span class="Apple-converted-space"> </span>wrote:</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><blockquote class="gmail_quote" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: kremenek<br>Date: Mon Feb 18 01:18:28 2013<br>New Revision: 175425<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=175425&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175425&view=rev</a><br>Log:<br>Disable dead stores checker for template instantations.  Fixes <<a href="rdar://problem/13213575">rdar://problem/13213575</a>>.<br><br>Modified:<br>    cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp<br>    cfe/trunk/test/Analysis/dead-stores.cpp<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=175425&r1=175424&r2=175425&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=175425&r1=175424&r2=175425&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp Mon Feb 18 01:18:28 2013<br>@@ -419,6 +419,15 @@ class DeadStoresChecker : public Checker<br> public:<br>   void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,<br>                         BugReporter &BR) const {<br>+<br>+    // Don't do anything for template instantiations.<br>+    // Proving that code in a template instantiation is "dead"<br>+    // means proving that it is dead in all instantiations.<br>+    // This same problem exists with -Wunreachable-code.<br></blockquote><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br></div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">I believe last time we spoke about this we agreed that correctness can be attained by examining template patterns not specializations for unreachable code. Your concern was one of performance that I never did get around to providing numbers for (your concern was that examining all template patterns might be too expensive) - I'm not sure if you have the same concern for the Static Analyzer in this regard, or an easier way to verify the perf impact to thins you care about here.<br><br>(or perhaps the Static Analyzer already gets this right by examining template patterns elsewhere?)</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"> </div></blockquote></div><br><div>Hi David,</div><div><br></div><div>You are correct.  While it is true the analyzer has more "CPU time to burn" than a compiler warning, here was my thinking:</div><div><br></div><div>(1) This warning should possibly be made one day into a compiler warning, where the same performance requirements for -Wunreachable-code apply.  Thus until we feel comfortable with the solution we devised for -Wunreachable-code, it seems reasonable to wait on applying the same solution here.</div><div><br></div><div>(2) This was designed to be an expedient solution, addressing a clear case of reducing false positives.  This code has not been tested at all on analyzing template patterns, which was beyond the time I had to work on this right now.</div><div><br></div><div>I still agree with you, however, that looking at template patterns may be the best long-term solution, but there are many details left to be figured out there.</div><div><br></div><div>Cheers,</div><div>Ted</div><div><br></div></body></html>