<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88111>88111</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`bugprone-infinite-loop` incorrectly claims infinite loop
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bbannier
</td>
</tr>
</table>
<pre>
For `do`/`while` loops with unchanged loop condition the loop (while pointless) will execute exactly once, but `clang-tidy`'s `bugprone-infinite-loop` check incorrectly claims that the loop would be infinite.
```cpp
int main() {
bool changed = false; // Diagnostic disappears if declared `constexpr`.
do { // This loop is infinite; none of its condition variables (changed) are updated in the loop body
} while ( changed );
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Ul2OmzAQPs3wMkpkDDHhgYfdRjlBL2DsCUzr2Mg2m93bVybZzaqqKkVB-mC-n_lGp8STJxrg8AqHU6XXPIc4jKP2nilWY7AfwzlEBCVsACVAnkGJ28yOQAl0ISwJb5xnXL2ZtZ_IbiCa4C1nDh7zTHcI5HEbxCWwz45SAtnjjZ1DeiezZkJ61ya7DwzeEMgfOK65SBun_bTLbD82C10q4LhOSwyeduwv7DnTrqgUV2Ym8xvZmxAjbXzGab4mzLPOTz-3sDqLI-EnwR7ECcTL41-J-88syx1hn_Gq2YM8FuPQvd5xRMQxBIefC4DmhBftEkHzilhWJs94Yj35kDIbtJz0spCOCfmClozTsYwpYYJPmd6XCErsn-w2FLUvqp8zp3sETl_mi5YPnjBckHP6VsCbjqxHR6k08PBYAuhIuC5WZ7LI33oqpT-1oTvhvTaQx2dE2UPzyA_d6a-VVXZobN_0uqKh7mqplFSyr-bBmLYzdXdpW2GNHZtOSdm1pO2xazt5aCoepJCtaEVf14069Hth-rEzisRFNqSOElpBV81u79zbdR_iVHFKKw3HY13XldMjubRds5Sebri9BCnLccehzOzGdUrQCscppydL5uxo-O9Z_eOgPr_ZFlet0Q1zzkuC5uVe1cR5Xse9CVeQ56L1eOyWGH6RySDPm8ME8rwl-BMAAP__MQYiZQ">