emmtrix is supporting C-Vise/C-Reduce open-source tools!

September 20, 2022

Some months ago, we came across the C-Reduce tool. C-Reduce takes a large C/C++ program that has a property of interest (such as triggering a compiler bug) and automatically produces a much smaller C/C++ program that has the same property. Since that we are using C-Reduce on our daily development to reduce failing test cases for our C++-to-C compiler. E.g. only a small C++ program that is including the <string> header has already over 1MB of source code that the compiler must process. With C-Reduce we can automatically reduce such test case within 15 min to 500-1000 bytes.

We soon recognized that there is room of improvement since C-Reduce failed to eliminate some C++ template language elements. Inside C-Reduce, a clang-based tool called clang_delta applies several so called transformations on the C/C++ code that are used for reduction. We switched to C-Vise fork which is faster and more actively maintained. We changed clang_delta and improved existing and created new transformations. Now we are able to automatically reduce typical test cases to 100-200 bytes (see the picture for a before and after comparison)! All modifications are provided as pull requests and are already merged.

Thanks to all contributors of C-Reduce and C-Vise!

Reduction of a  typical test case
Cookie Consent with Real Cookie Banner