<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/109952>109952</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm-cov][MC/DC][Qualification] MCDC coverage does not work for negation
</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>
# MCDC coverage does not work for negation
## Criticality: HIGH
During qualification of MCDC coverage at Validas we found that
In the following example the term “(!v0) && v1” is not analyzed correctly.
the negation operator takes a boolean input and produces a boolean output.
Therefore it has to be instrumented as well such that the impact from v0 to the result can be analyzed.
This results in a wrongly calculated MCDC coverage measured by LLVMCov.
We also observed that the expected results are wrongly computed in the test vector line, for example v0=T, v1=T
the expected result should be F but is compouted to T
Note1: In plain C there is no native boolean type defined, therefore instrumentation is restricted to && and ||,
but for C++ and Rust the boolean type exists and therefore operators on it should be considered for MCDC coverage.
Note2: In some more complex cases e.g. "if (((!((!FALSE)||TRUE))||((!v0)&&v2)))" a warning is displayed
during instrumentation that the boolean expression is not supported. But this warning is printed not for all negated
terms, where no terms seams to work properly.
The problem occurs within Rust and C++.
Rust example:

Source code and generated reports:
[Test_000011.zip](https://github.com/user-attachments/files/17129320/Test_000011.zip)
C++ example:

Source code and generated reports:
[Test_000011.zip](https://github.com/user-attachments/files/17129337/Test_000011.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVk9v27gT_TT0ZWBDoizbOviQ2PWvBdofsG22ewwoamRxS5Fa_lHifvrFULLT5FAUPS0gSBQ5nDfz3gxB4b06G8Q9K-9ZeVyIGDrr9uhlh07jchRaNcIvattc9owX8OlwPIC0IzpxRmgsejA2wJN136C1DgyeRVDWsOzIsjvGC9p0cCooKbQKF1bcwfsP_3s_rR-jU-YM_0ShVatk2gm2fYMiAnyd4oAnhNZG00DoRJh8fDAQ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