<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - -Wsometimes-uninitialized and -Wconditional-uninitialized give suboptimal fixit with 'bool' variables"
href="http://llvm.org/bugs/show_bug.cgi?id=17290">17290</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-Wsometimes-uninitialized and -Wconditional-uninitialized give suboptimal fixit with 'bool' variables
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sean@rogue-research.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11239" name="attach_11239" title="repro case">attachment 11239</a> <a href="attachment.cgi?id=11239&action=edit" title="repro case">[details]</a></span>
repro case
Consider these two warnings:
---------------------
/Users/sean/external/CMake/Utilities/cmcurl/multi.c:928:13: warning: variable
'protocol_connect' may be uninitialized when used here
[-Wconditional-uninitialized]
if(!protocol_connect) {
^~~~~~~~~~~~~~~~
/Users/sean/external/CMake/Utilities/cmcurl/multi.c:766:24: note: initialize
the variable 'protocol_connect' to silence this warning
bool protocol_connect;
^
= '\0'
---------------------
and
---------------------
test.c:8:7: warning: variable 'foo' is used uninitialized whenever 'if'
condition is false [-Wsometimes-uninitialized]
if (random() % 2)
^~~~~~~~~~~~
test.c:13:7: note: uninitialized use occurs here
if (foo)
^~~
test.c:8:3: note: remove the 'if' if its condition is always true
if (random() % 2)
^~~~~~~~~~~~~~~~~
test.c:7:11: note: initialize the variable 'foo' to silence this warning
bool foo;
^
= 0
---------------------
This is with trunk: "clang version 3.4 (trunk 191016)"
In both cases, it would be better if the fixit suggested using 'false' instead
of '\0' or '0' since the variable in question is a 'bool'. See attached
trivial test case.</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>