<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="MSHTML 11.00.10586.545">
<style id="owaParaStyle" type="text/css"></style>
</head>
<body fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>Hello!</div>
<div><br>
</div>
<div>I am not against that those warnings are available _also_. Imho the heuristic is too noisy for me right now so I would be happier if I could personally disable that for now. Move the heuristic to alpha or something.</div>
<div><br>
</div>
<div>> I've seen the analyzer find real problems where loops are not executed and think this is very useful. Personally I'd rather see the warnings and add asserts, which makes it clearer that 'nr' must be greater than 1, making it less likely someone will
 add an incorrect call in the future. While that is a preference for avoiding false negatives over false positives, I think it is reasonable in this case given there is no analysis across translation units.</div>
<div><br>
</div>
<div>I am trying to introduce Clang analyzer on an existing large code base and they don't want to see any false positives. I would ideally like to have very restrictive checking for uninitialized variables right now.</div>
<div><br>
</div>
<div>It is acceptable to add _some_ assertions and annotations to achieve no false positives. But I'm afraid it looks bad that most of the warnings are wrong right now.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Daniel Marjamäki</div>
<div><br>
</div>
<div>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">..................................................................................................................</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span style="font-family:'Arial','sans-serif'; color:black; font-size:8pt">Daniel Marjamäki
</span><span style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Senior Engineer</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8.5pt">Evidente ES East</span><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"> AB<span> 
</span>Warfvinges väg 34<span>  </span>SE-112 51 Stockholm<span>  </span>Sweden </span>
</p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Mobile</span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">:<span>                
</span>+46 (0)709 12 42 62</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">E-mail:<span>   
</span><span>             <a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se">
Daniel.Marjamaki</a></span><a tabindex="0" href="mailto:Daniel.Marjamaki@evidente.se">@evidente.se</a><span>     
</span><span>                 </span></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; font-size:8pt">www.evidente.se</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF11405" style="direction: ltr;"><font color="#000000" face="Tahoma" size="2"><b>Från:</b> Piotr Padlewski [piotrekpad@gmail.com]<br>
<b>Skickat:</b> den 25 augusti 2016 19:07<br>
<b>Till:</b> Sean Eveson<br>
<b>Kopia:</b> Clang Dev; Daniel Marjamäki<br>
<b>Ämne:</b> Re: [cfe-dev] RFC clang analyzer false positives (for loop)<br>
</font><br>
</div>
<div></div>
<div>
<div>I totally agree. If you have such constrain then you should express it in code, for example using do-while or assert, or why just not initialize the value?<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Aug 25, 2016 08:15, "Sean Eveson via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr"><span style="font-size:12.8px">Hi,</span>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">I've seen the analyzer find real problems where loops are not executed and think this is very useful. Personally I'd rather see the warnings and add asserts, which makes it clearer that 'nr' must be greater than 1, making it less
 likely someone will add an incorrect call in the future. While that is a preference for avoiding false negatives over false positives, I think it is reasonable in this case given there is no analysis across translation units.</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">You tend to get false positives when the Analyzer can't see any calls to the function, so doesn't know 'nr' can never be less than 1. You can get false negatives when the analyzer can only see some of the calls.</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr"><span style="color:rgb(0,0,0); font-family:"Segoe UI","Segoe UI Web Regular","Segoe UI Symbol","Helvetica Neue",Helvetica,Arial,sans-serif; font-size:13px; line-height:18.85px">Sean Eveson</span><br style="color:rgb(0,0,0); font-family:"Segoe UI","Segoe UI Web Regular","Segoe UI Symbol","Helvetica Neue",Helvetica,Arial,sans-serif; font-size:13px; line-height:18.85px">
<span style="color:rgb(0,0,0); font-family:"Segoe UI","Segoe UI Web Regular","Segoe UI Symbol","Helvetica Neue",Helvetica,Arial,sans-serif; font-size:13px; line-height:18.85px">SN Systems - Sony Computer Entertainment Group</span><br>
</div>
</div>
</div>
<div class="elided-text"><br>
<div class="gmail_quote">On Thu, Aug 25, 2016 at 8:55 AM, Daniel Marjamäki via cfe-dev
<span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
Hello!<br>
<br>
One more email about false positives.<br>
<br>
I see many false positives in code like this:<br>
<br>
    int f(int nr) {<br>
      int x;<br>
      for (int i = 0; i < nr; ++i) {<br>
        x = i;<br>
      }<br>
      return x;<br>
    }<br>
<br>
Theoretically, if "nr" is less than 0 then the return value will be uninitialized.<br>
<br>
As far as I have seen we know that such loops are executed at least once very often. I can't remember a TP where it was possible that such loop code would not be executed.<br>
<br>
Can we try to fix this so the analyzer will be silent for the above code? I would like that if the variable is unconditionally written in the loop code there should be no warning.<br>
<br>
Best regards,<br>
Daniel Marjamäki<br>
<br>
..............................<wbr>..............................<wbr>..............................<wbr>........................<br>
Daniel Marjamäki Senior Engineer<br>
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden<br>
<br>
Mobile:                 <a href="tel:%2B46%20%280%29709%2012%2042%2062" target="_blank" value="+46709124262">+46 (0)709 12 42 62</a><br>
E-mail:                 <a href="mailto:Daniel.Marjamaki@evidente.se" target="_blank">Daniel.Marjamaki@evidente.se</a><br>
<br>
<a href="http://www.evidente.se" target="_blank" rel="noreferrer">www.evidente.se</a><br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" rel="noreferrer">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" rel="noreferrer">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>