<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>Hi, CSA community.<br>
</p>
<p><br>
</p>
<p>I got an idea how to make RangeConstraintManager more sofisticated.<br>
</p>
<div><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">I want you speak out, share your vision about this idea.</span><br>
<br>
</div>
<p>Actually this bug <a href="https://bugs.llvm.org/show_bug.cgi?id=13426">https://bugs.llvm.org/show_bug.cgi?id=13426</a> pushed me to these thoughts.<br>
</p>
<p>Let's consider the next snippet:<br>
</p>
<p><br>
</p>
<div>
<div><span style="font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">int foo(int y, int x) {</span></div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">int x;</span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">if (y == z) {</span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">x = 0;</span></div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">}</span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">if (y != z) {</span></div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">x = 1;</span></div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">}</span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="white-space: pre; font-family: Consolas, monospace;"></span><span style="font-family: Consolas, monospace;">return x;</span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-family: Consolas, monospace;">}</span><br>
</div>
<div><span style="font-family: Consolas, monospace;"><br>
</span></div>
Finally CSA reports you: <br>
</div>
<div>
<div><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">warning: Undefined or garbage value returned to caller</span></span></div>
<div><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"> [core.uninitialized.UndefReturn]</span></span></div>
<div><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"> return x;</span></span><br>
</div>
<div><br>
</div>
<div>But as a human <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">you</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"> </span>know that
`x` has <span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
definitely </span>been initialized.<br>
</div>
<div>As you can see CSA builds paths without relying on previous conditions (except the case {A-B} {B-A}m it is already done).<br>
</div>
</div>
<div>The same behavior appears when:<br>
</div>
<div><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">(y > z)</span></span></span><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">
(y <= </span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">z)</span></span></span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">(y <= z)</span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"> (y > </span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">z)</span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"></span><br style="font-family: Consolas, monospace;">
</div>
<div><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">(y == z)</span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"> (z !=
y</span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;"><span style="font-family: Consolas, monospace;">)</span></span></span><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;"></span></div>
<div><span style="font-size: 16px; background-color: rgb(255, 255, 255); font-family: Consolas, monospace;">etc.</span></div>
<div><span style="font-size: 12pt;">I made a solution for this but have not upload it for review yet</span><span style="font-size: 12pt;">.</span></div>
<div><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">I also have some more thoughts about optimization such:</span></div>
<div><span style="font-size: 12pt;"></span><span style="font-family: Consolas, monospace;">if (y < z) {</span><span style="font-family: Consolas, monospace;">}</span></div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">
<span style="font-family: Consolas, monospace;">if (y <= z) {} // which is a subset of <span style="font-family: Consolas, monospace; font-size: 16px; background-color: rgb(255, 255, 255);">(</span><span style="font-family: Consolas, monospace; font-size: 16px; background-color: rgb(255, 255, 255);">y
< </span><span style="font-family: Consolas, monospace; font-size: 16px; background-color: rgb(255, 255, 255);">z</span><span style="font-family: Consolas, monospace; font-size: 16px; background-color: rgb(255, 255, 255);">)</span></span></div>
<div style="font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</div>
<div style="font-size: 16px; background-color: rgb(255, 255, 255);">I can continue to do this improvement and show you the result soon.<br>
</div>
</div>
<p><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>