<html>
<head>
<base href="https://bugs.llvm.org/">
</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` false positive for assignment"
href="https://bugs.llvm.org/show_bug.cgi?id=50236">50236</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>`-Wsometimes-uninitialized` false positive for assignment
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>xtkoba@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24832" name="attach_24832" title="Repro">attachment 24832</a> <a href="attachment.cgi?id=24832&action=edit" title="Repro">[details]</a></span>
Repro
Compiling the attached C source (named sometimes.c) gives the following
warning:
sometimes.c:8:7: warning: variable 'a' is used uninitialized whenever 'if'
condition is false [-Wsometimes-uninitialized]
if (!c) c = foo(&a);
^~
sometimes.c:9:7: note: uninitialized use occurs here
b = a;
^
sometimes.c:8:3: note: remove the 'if' if its condition is always true
if (!c) c = foo(&a);
^~~~~~~~
sometimes.c:7:8: note: initialize the variable 'a' to silence this warning
int a, b;
^
= 0
1 warning generated.
At line 9, the value of sometimes-uninitialized variable `a` is only assigned
to another variable `b`, and so it should not be warned until the value is
actually used.</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>