mc-imperial / dredd

Framework for evaluating C/C++ compiler testing tools
Apache License 2.0
11 stars 3 forks source link

Prevent expression-under-cast-bypass in Initializer Lists for more mutations and narrowing type handling #278

Closed JonathanFoo0523 closed 1 month ago

JonathanFoo0523 commented 1 month ago

Avoid bypass of implicit inner cast mutation under default (optimize_mutations) mode for expressions in Initializer List. Besides producing more mutants, this change ensures that Dredd can correctly handle narrowing type expressions involving std::initializer_list without bypassing necessary static_cast operations.

Fixes #270

JonathanFoo0523 commented 1 month ago

Check failed due to

Found 68841 mutants when mutating the SPIR-V validator source code. Expected 68821. If Dredd changed recently, the expected value may just need to be updated, if it still looks sensible. Otherwise, there is likely a problem.
afd commented 1 month ago

@JonathanFoo0523 The failure looks reasonable since your change introduce more mutants. Therefore can you please go into .github/workflows/cxx_apps.sh and change the expected value for the number of spirv-val mutants? Then try the CI again and it will probably fail for an analogous reason with respect to LLVM InstCombine, which you can also update (assuming the change is that the number of mutants goes up slightly). These checks are mainly in place to guard against unexpected changes - where we do a fix or refactoring that should have no effect on the number of mutants.

afd commented 1 month ago

Oh, looks like you already did this for SPIR-V, so you probably just need to do it for LLVM. You'll have to download the log files to see the change that's needed, as the CI output for cxx_apps is very large.

afd commented 1 month ago

This is failing because the cognitive complexity of HandleExpr has gotten too high. This is normally where one needs to think about extracting out a helper function. Is there an obvious piece of logic related to your additions that could be extracted out?