<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/83125>83125</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
valgrind error in llvm::APInt::setBits
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
This C code:
int CoordType;
void Distance_TOR_3D() {
if (CoordType != Distance_TOR_3D)
Distance_TOR_3D();
}
does this with recent clang trunk:
$ valgrind -q --trace-children=yes /home/dcb38/llvm/results/bin/clang -c -O1 bug36.c
bug36.c:3:17: warning: comparison between pointer and integer ('int' and 'void (
*)()') [-Wpointer-integer-compare]
3 | if (CoordType != Distance_TOR_3D)
| ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
==1082850== Conditional jump or move depends on uninitialised value(s)
==1082850== at 0xCBACA9: llvm::APInt::setBits(unsigned int, unsigned int) (in
/home/dcb38/llvm/results.20240227/bin/clang-19)
==1082850== by 0x1153296: computeKnownBits(llvm::Value const*, llvm::APInt co
nst&, llvm::KnownBits&, unsigned int, llvm::SimplifyQuery const&) (in /home/dcb3
8/llvm/results.20240227/bin/clang-19)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE2TozYQ_TXNpQsXSGDgwIExoSqVw-ZjKjluCdTG2mDJkcR4fclvTwmwZ3Z2K1uJDi416u73-nW7hXNq1EQ15E-Qt5GY_cnYWg49T7OoN_JWP5-UwwMORhLwBpIWku1XaY8HY6x8vl0I-NP69cUoia1yXuiBPj5_-PUjb4GVwCqEYvNBVEcEVj6iEVgKvP06rtoCvpnwgQlF-5aYNOTQB95X5U9oaSDtcZiEHtHbWf_5rhBgGb6IabRKS4z_wjj2VgwUDyc1SUsaeHsjh8C6kzkTsC7oUwLrpunlDKyz5ObJO2BdrzSwbkWKB4w_pNjPI9_vhhXpbvCGA2_SAniDV2G10mO4DuZ8EVY5o7EnfyXSeDFKe7IotMRwG8niUn2htAdWLA_AikX28LBV1AR9VpVYsYifP8V_bNniLVO8AhLk7b0xiByhOOB_b9Fy1tBw_r4fhPyHV2s9G0veAm_TpGRlnqwGHoyWyiujxYSf5vMFjcWzeSGUdCEtHRqNs1ZaeSUm5UiGzs0ErHQPKt_Ki4jCY_L58NQcmiqIvTSPN8Cb5ucftV-vjvyTCq0sZ738NRbVgR3wS7sK2ii9lf69ydixhGUJC414OyJxWn2Pc3_D5HOa5pxV-_uEzJ5-0uaqN6KvdfwelMDBaOeXATi8rxEHs6ItHvsvPd7k3H9d8FvP39T5Mqnj7ZeZ7O2Ot3-I8k6OFfF_iRLJmsuKVyKiOi2SKuFZku2jU30sMtoXg-R5XmUJZ31e7vtjUZVlVh0pKyNV37OnaYjZUZHLVGR9mmRZLvICsoTOQk27QGpn7Bgp52aqS56yPJpET5NbtiJjmq64PAJjYUnaOsTE_Tw6yJJJOe9es3jlJ6of24SsNRaV_tdpi2Y71SfvLy58Zh2wblT-NPe7wZxfdVtQL9Z8osED6xZKYekslP8JAAD__6K6uSo">