<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Missing -Wuninitialized warning with some gotos"
href="https://bugs.llvm.org/show_bug.cgi?id=43717">bug 43717</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>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Missing -Wuninitialized warning with some gotos"
href="https://bugs.llvm.org/show_bug.cgi?id=43717#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Missing -Wuninitialized warning with some gotos"
href="https://bugs.llvm.org/show_bug.cgi?id=43717">bug 43717</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>This is working as intended.
-Wuninitialized warns on cases where a particular use of a variable is only
reachable in cases where the variable is uninitialized. (So either that use of
the variable is unreachable, or you have a use-uninitialized bug.)
-Wsometimes-uninitialized warns on cases where a particular branch always
results in an uninitialized use whenever it's taken. (So either that branch can
never be taken in that direction, or you have a use-uninitialized bug.)
Under the assumption that you have no dead code, both warnings have zero false
positives.
If instead you want a warning with fewer false negatives (but that instead has
false positives), you can use -Wconditional-uninitialized. That will warn
whenever we see a use of a variable and we can find any path to that variable
that didn't initialize it. (This has false positives if the path that we find
is actually impossible -- for instance, if it contains two branches on the same
value and requires them to go in different directions.)
-Wconditional-uninitialized does warn on this code:
<stdin>:20:16: warning: variable 'status' may be uninitialized when used here
[-Wconditional-uninitialized]
return status;
^~~~~~
<stdin>:4:19: note: initialize the variable 'status' to silence this warning
int status;
^
= 0
(You can also use -Weverything to find out whether clang has a warning for a
particular construct.)</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>