C-Reduce is a tool which takes a large C or 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. It is intended for use by people who discover and report bugs in compilers and other tools that process C/C++ code.
C-Reduce is structured as a fixpoint computation that calls a collection of plugins. It is these plugins that actually transform the test case that is being reduced. C-Reduce is thus very easy to improve and extend. In particular, we believe it would be quite easy to add passes for reducing other programming languages.
Please see our INSTALL file.
C-Reduce has been tested on MacOS X, FreeBSD, and several versions of Linux.
(Experimental.) As described in the INSTALL instructions, compiling C-Reduce and its clang_delta tool requires one to install appropriate versions of LLVM and Clang. For those who do not want to compile clang_delta themselves, we offer binaries compiled for selected platforms:
Note that the above files do not contain the creduce driver script, which is currently found in the source-code distributions only. We are exploring better ways to provide complete, precompiled distributions of C-Reduce in the near future.
creduce ./test1.sh file.c
Where file.c is a C compilation unit that you wish to reduce and test1.sh is a shell script that returns 0 if a partially reduced C program (a "variant") is interesting and non-zero otherwise. The test script takes no arguments; it should be hard-coded to refer to the same C file that is passed as an argument to C-Reduce.
For more details, please see Using C-Reduce.
If there is demand we might:
If you would find these (or other) features useful, please let us know.
If you find C-Reduce to be useful, please let us know. If it does not work, please let us know about that too. There are two mailing lists: