<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/109940>109940</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [llvm-cov][MC/DC][Qualification] Too High MCDC coverage for C++ 
        </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>
    # Too High MCDC coverage for C++ 
## Criticality: HIGH
During qualification of MCDC coverage at Validas we found that 
the computation of MCDC coverage for the term "if ((TRUE ||TRUE) && v2)" is too high.
The result is 100%, but should be 33% (or 50% or 66% depending on the interpretation of folded constants).
This is highly critical, since tester might think they have covered everything and do not optimize the code.
When we run the same example using Rust, we see 50% coverage, which is different and safe.

Rust example:
![constant_folding_rust](https://github.com/user-attachments/assets/bf013ec4-b800-4567-a510-a517b368c203)
Source Code and generated Reports:
[Test_000005.zip](https://github.com/user-attachments/files/17128734/Test_000005.zip)


C++ example:
![constant_folding_cpp](https://github.com/user-attachments/assets/d249dfeb-1cf9-433d-ae4f-abcba3f98d7c)
Source Code and generated Reports:
[Test_000005.zip](https://github.com/user-attachments/files/17128714/Test_000005.zip)


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlMGSozYQhp9GvnThghYycOAwxnEmhz1kMkmOU0JqQAkgIglPZp8-JWzvbG1Vkq09rQ-SXN3q_-vfckvvTT8T1UwcmTjt5BoG62ryaiA3UnKRo9HS71qr32qGHJ6thUfTD_ChOTWg7IWc7Ak666BheGR4BJaeWPrAkMf8xplglBxNeGP8AR5_-vHxGj-tzsw9_LXK0XRGyWDsDLb7oq4M8NsVAV6jyjprCIMMN5EwECg7LWv4l_uRKyYFchMwRNMBw5Jh-fz06w_AioYVTTwyrIDhgeEBLsiwYohgPARrYTD9sL_KPQ8Ejvw6hhjM0pShYNhAuwbwg11HDS0B5wxFlLEOREwB6-BwiAdNC8069m3njcvMgdzi6J2_s6MmDcrOPsg5eIbVJ3Xjo24EGt9A3ZyNAN7MKjbpAzmYTD8ECIOZ_4wabzDIC10tIQ10IfcWgz3IWYO2MNsAdglmMh8Jro5qumn-PtAcnXfrldfLiYD-ltMyEqw-VnlafYgMrwSe6Nbx_QfYAoNRQwTXpuvI0Rw2ZS-7u8p1jYXutRl_uD-jjInj3Y2X6I6Z-xcXRcWJYTmEsPiYjmeG596EYW33yk4Mz6snl8gQpBom2qw8S-9pO7RdmnFSedKWaZrk4lAkUmRpXIqWH0qFKY_vYIP4xa5OETRW04be00xOBtLwRIt1wb_jiuMz-fCSxo_YfzTLt1B2ZqS4Z0WGZcFzhucvq97RPl_vf8Cv9FAt3wT3yUKNeaU7apNMdVWSc64TSXmXyFa1kndVqQv1nViY_b-FO11zXfFK7qjOCixQFFmW74Y6E1WZipanWdsVKOShKvKDKiXPBUqOxc7UmGKeVijSipc83x9UWWh5yFXBCQVqlqc0STPux_Ey7a3rd8b7leosrao83Y2ypdFvExhxplfYogwxDmRXx0tJu_ae5elofPDvZYIJ4za6txxlL9EpcfzQMDyfmuuXnz8fsEycvmaC71Y31v_hd5S7bcni7B-kAsPzhr15fu3rUuM_AQAA__82HPzD">