<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:Jani_Lahtinen@mcafee.com" title="Jani_Lahtinen@mcafee.com">Jani_Lahtinen@mcafee.com</a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Analyzer cannot determine std::string empty"
href="http://llvm.org/bugs/show_bug.cgi?id=20798">bug 20798</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Analyzer cannot determine std::string empty"
href="http://llvm.org/bugs/show_bug.cgi?id=20798#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Analyzer cannot determine std::string empty"
href="http://llvm.org/bugs/show_bug.cgi?id=20798">bug 20798</a>
from <span class="vcard"><a class="email" href="mailto:Jani_Lahtinen@mcafee.com" title="Jani_Lahtinen@mcafee.com">Jani_Lahtinen@mcafee.com</a>
</span></b>
<pre>No, it is the correct one. The inference path goes so that first you set 'err =
"something"' and then later conclude that 'err.empty() == true'.
if (args.size() != 1) // Taking true branch.
{
err = "missing arg"; // <= err is now not empty.
}
...
if (!err.empty()) // Taking false branch, and therefore err is empty.
{
printf("Error: %s\n", err.c_str());
usage = true;
}
The point is not that is 'x' uninitialized when we assign it to 'xxx' in the
inference path, but that the path should never reach that because:
if (usage) // <== usage should be now true.
{
printf("Usage\n");
return 0;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>