Issue 109952
Summary [llvm-cov][MC/DC][Qualification] MCDC coverage does not work for negation
Labels new issue
Assignees
Reporter escherle-validas
    # 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:
![wrong_result_simple_rust](https://github.com/user-attachments/assets/2d8f31b5-f5b9-462b-88b5-b57e288b5364)
Source code and generated reports:
[Test_000011.zip](https://github.com/user-attachments/files/17129320/Test_000011.zip)

C++ example:
![wrong_result_simple_cpp](https://github.com/user-attachments/assets/f12fff73-050c-4795-b5bb-8bdcb96dd424)
Source code and generated reports:
[Test_000011.zip](https://github.com/user-attachments/files/17129337/Test_000011.zip)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to