<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125292>125292</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Potentially misleading diagnistics in -Wconditional-uninitialized
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
earnol
</td>
</tr>
</table>
<pre>
The conditional-uninitialized diagnostics checker issue warnings even in cases when the initialization is clearly performed.
Here is the example:
```
int a(int p1)
{
int cv = 1;
int ibn;
if ((cv < 5) && (p1 == 1))
{
ibn = 2;
p1 += 1;
cv++;
}
if(cv == 2)
{
return ibn;
}
return 8;
}
```
The warning generated is: "warning: variable 'ibn' may be uninitialized when used here [-Wconditional-uninitialized]".
In this case depending on the passed value p1 the variable ibn might be not initialized when used in the return statement.
However the code is written in such way that variable `return ibn;` line is executed only when ` ibn = 2;` is also executed. Thus the warning is technically superfluous.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE-PuzYQ_TTmMtoIhuXfgUPSKGpvPfykno2ZgFtjI9uQTT99NUC2u-ofCQk84_dmmPdsGYIeLFEriosorolc4uh8S9JbZ5LO9c_2x0ignO111M5K87ZYbXXU0ug_qYdey8G6ELUKoEZSf5AHHcJC8JDeajsEoJUsaAtKBgrwGMlCHAk-WSQTgw6gDElvnjCTvzs_UX8S6fln8sRJhtCHnGZDIj-L9CzK9HjSs7YRpMCa33MmsAHeUF0AgL8AOKFWEPkVMpFfOMYh3dljBfoOAmuB9bbtJyg2FiwFlpyYMwbveGz4YZCodjAw08aOLz4AhuDla0m1coBjlwN-PWq_6l53jn_Qe4qLt0e_8ALvH0eu3ll3zq_DYQEPMWAgS15G6kEHkZ9BIB4pXq3Sa9kZAoEVl8IKJvmEjuC76JuGS6AeRlZHFJe33_7TIqK4CkSW8hcWnnWWgaCnmWzPPbndD7MMzLhKsxDPjmOfDfF4Jz2MkZuxLsK_t6N3qmMiIcpIE9m4-cg9aCW_5ZXrN089vI5xN2dY1AgP-YQ4yvhlEGX6bfSiTMFou6Hpg9TCo3TWPPcmOP3NCbwOIE1wn9tP8GNcdj-_VGF7kxqtVtKYJ4SFT4BZ3BJOLHHSt3nf5I1MqM2qvM6LqsrqZGzlvWnKe9fd86zqu6zDIsWi7u5N2WekVJnoFlMs0izPMEvrvD6VJaZdl2dlrzAt3jPxntIktTkZs04n54dkO7xthgU2mBjZkQnb5YBo6bEfbYHId4VvGfTWLUMQ76nRIYa_aaKOhtpfXSTLOpknTDoYkpvi26Wh90tDW_gf8ySLN-0Y48xuFXgTeBt0HJfupNwk8Mb1jtfb7N3vpKLA29ZlEHg7fmNt8a8AAAD__2Xjjgs">