<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/109944>109944</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm-cov][MC/DC][Qualification] Constant folding yields too high MCDC coverage (Rust)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
escherle-validas
</td>
</tr>
</table>
<pre>
# Constant folding yields too high MCDC coverage (Rust)
## Criticality: MEDIUM
During qualification of MCDC coverage at Validas we found that
constant folding produces wrong (too high) coverage results in case of incomplete coverage.
In the following example where the term "(true || true) && v2" contains constants we would
expect that 1 / 3 atoms are covered (= 33.3 % MCDC), but LLVM Cov measures 50 % MCDC.
Since coverage is less than 100% a manual analysis and explanation is required, therefore the safety cirticality is not high.
Note: For the same example in C++ 100 % MCDC is measured by llvm-cov (see #109940)
![constant_folding_rust](https://github.com/user-attachments/assets/dd5da72e-a203-4505-badd-20f22f097892)
Example Source Code:
[Test_000005.zip](https://github.com/user-attachments/files/17128861/Test_000005.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVM2O4jgQfhpzKYGcCu6QQw5NGKSRplfand25thy7QrxybMZ2oNmnXzmE7lUf9jBcbOTi-6uiZIzm5IgaJvZMHFZySoMPDUU1ULC0vkhrtIyrzutbw7CE1ruYpEvQe6uNO8HNkNURkvcwmNMAL-2hBeUvFOSJgOHujykmhjXjB8afGZYzSjDJKGlNurHyGV6-HL7-9XKvOEwhw_6cpDW9UTIZ78D3n3Blgh93aXAl6P3kNKRBpjuG-izyHLyeFEW4Bu9OWdVDL8P6AzVQnGyKYBwoGSnTGqf8eLaU6L1scyf56iANmdtaf80k9CZzJVwHCjS_JQojMMTMFyYCVrWsaiHfMy_DJ4ZPcEGGCMq7JI2L8BA_O7v6yWq4E9LbmVSabUIBDI9Qgkx-jCDDoo509sbKA5TlpgSGYs4tx48tdFOCb99-vEDrLzCSjFOgCIK_1y3OvhunPuyCiWApxkzsoOA8V0sYpZukBemkvUUTQToN9Ha20t1bZiIE-jmZQDpzpxxK75dgouwp3UCZ8BiDXO98mnuyyPjNJ8rTcfRh-dFI7yEbBy3DPcN9lvTuIMMszjR0N7D2Mq6Vv-RYIuV5LAte11v-MZHLXBZM7B_Rvy5z8xry7IoDw92Q0jmy8pnhkeHxZNIwdRvlR4bHKVJYy5SkGkZyKTI8yhhpvmgttKyQ1hJ5ud4KLtad1HqNvEfseV3tavwk5cvi8LufgiJovc4pLBVi_yfF9MrzR2z-MedfUdcbS_ksqgJ3u6eC4fEz6kPSSjelrstarqgpKqxQVHVVrYZGUCmfVFHJrdxVXaeFkEL1hVJd1W2Ry5VpkOOW1yh4LVBUm11H5bbnStcCOVLBtpxGaewm92jjw2llYpyomfuzXVnZkY3zXkJ0dIX5Nf-ZxGEVmrmx3XSKbMutiSl-wCST7LzQHs3PGYn9S8vweGjvX37_73ph4vDre201Bdv8T_5ZxHKsz8H_TSoxPM5m5h7c3V4a_DcAAP__Li7C4A">