Open whentojump opened 1 month ago
Thanks for filing this. My notes: CounterCoverageMappingBuilder::ConditionFoldsToBool()
relies on Expr::EvaluateAsInt()
, which is checked throughout CodeGen for constant folding. However, we probably need to check Expr::EvaluateAsBooleanCondition()
additionally (or maybe instead of). Conceptionally it should be easy to extend to support the /// Not expected ///
cases.
Reduced examples:
Compiler explorer link
For decisions in the
/// Not expected ///
section, the second condition can be evaluated to constant at compile time (in some cases, the compiler is indeed aware of that and produces warnings) but their corresponding branch regions are not0, 0
. As a result, in branch coverage or MC/DC they are not reported as "folded".On the other hand
gcov
can detect all cases. (Although it totally disregards them and doesn't have a third state like "folded")cc @evodius96