MC/DC in GCC paper (in preprint)

MC/DC in GCC paper (in preprint)

January 8, 2025

My paper on Modified Condition/Decision Coverage in GCC is published (in preprint)! You can get a copy from here or from arxiv. It covers the reasning, inner workings, and algorithms behind the -fcondition-coverage flag in GCC.

Abstract:

We describe the implementation of the masking Modified Condition/Decision Coverage (MC/DC) support in GCC 14, a powerful structural coverage metric with wide industry adoption for safety critical applications. By analyzing the structure of Boolean expressions with Binary Decision Diagrams we can observe the key property of MC/DC, the power to independently affect the outcome, and map to the edges of the Control Flow Graph. This mapping can be translated to a few bitwise instructions and enables GCC to instrument programs to efficiently observe and record when conditions have been taken and have an independent effect on the outcome of a decision. By analyzing the BDD rather than the program syntax, GCC can measure MC/DC for almost all of its languages with a single language-agnostic implementation, including support for C, C++, D, and Rust.

The design and programming of MC/DC support was initiated when I was at Woven by Toyota and finalised with funding from NASA.