<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Next code generates a sink node and a bug report:<br>
</p>
<p><br>
</p>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;">int setPtr(const int&);</span></div>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;">int* getPtr();</span></div>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;">void f(bool is, const int x, const int y)</span></div>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;">{</span></div>
<div><span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> const int *ptr = &x;</span><br style="font-family: Consolas, monospace;">
</span></div>
<div><span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> if (is) {</span><br style="font-family: Consolas, monospace;">
</span></div>
<div><span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> ptr =
<strong>nullptr</strong>;</span><br style="font-family: Consolas, monospace;">
</span></div>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;"> }</span></div>
<div><span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> setPtr(*ptr);</span><br style="font-family: Consolas, monospace;">
</span></div>
<div><span style="font-family: Consolas, monospace; font-size: 10pt;">}</span><br>
</div>
<p><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">But next code just generates</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"> a </span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">sink
node <strong>without </strong>a bug report</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">:</span><br>
</p>
<p><br>
</p>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Consolas, monospace; font-size: 10pt;">int setPtr(const int&);</span>
<div><span style="font-family: Consolas, monospace; font-size: 13.3333px; background-color: rgb(255, 255, 255);">int* getPtr();</span><br>
</div>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Consolas, monospace; font-size: 10pt;">void f(bool is, const int x, const int y)</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Consolas, monospace; font-size: 10pt;">{</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> const int *ptr = &x;</span><br style="font-family: Consolas, monospace;">
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> if (is) {</span><br style="font-family: Consolas, monospace;">
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> ptr =
<span style="font-family: Consolas, monospace; font-size: 13.3333px; background-color: rgb(255, 255, 255);">
<strong>getPtr</strong></span><strong>()</strong>;</span><br style="font-family: Consolas, monospace;">
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Consolas, monospace; font-size: 10pt;"> }</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-size: 10pt;"><span style="font-family: Consolas, monospace;"> setPtr(*ptr);</span><br style="font-family: Consolas, monospace;">
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;">
<span style="font-family: Consolas, monospace; font-size: 10pt;">}</span></div>
<p><br>
</p>
<p>Why does analyzer act like that? Is there any command line option to turn this on?<br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<hr>
<div><b>Denys Petrov</b></div>
<div>Senior ó++ Developer | Kharkiv, Ukraine</div>
<div><br>
</div>
<div></div>
</div>
</div>
</body>
</html>