Sitelet
https://web.archive.org/web/20210329025746/http://embed.cs.utah.edu/creduce/
C-Reduce
C-Reduce is a tool that takes a large C, C++, or OpenCL file that
has a property of interest (such as triggering a compiler bug) and
automatically produces a much smaller C/C++ file that has the same
property. It is intended for use by people who discover and report
bugs in compilers and other tools that process source code. C-Reduce is
released under a BSD-like
license.
Publications and Presentations
-
Test-Case Reduction for C Compiler
Bugs. John Regehr, Yang Chen, Pascal Cuoq, Eric Eide, Chucky
Ellison, and Xuejun Yang.
In Proceedings of 33rd ACM
SIGPLAN Conference on Programming Language Design and Implementation
(PLDI 2012), Beijing, China, June 2012.
-
Slides from John's talk at PLDI 2012
Design
C-Reduce is 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. Additionally, the C-Reduce core can exploit multiple cores
without exposing plugins to concurrency.
Installing C-Reduce
The easy way to install C-Reduce is to find a precompiled package
for your OS distribution. Ubuntu since 14.04 has C-Reduce and so do
Gentoo and Debian. If you are running macOS, Homebrew can give you
a C-Reduce.
If you want to compile and install C-Reduce yourself, please see our our INSTALL.md
file.
C-Reduce has been tested on macOS, FreeBSD, Linux, and Windows.
Source Code
Using C-Reduce
Run:
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.
Related Tools
-
Delta is a nice
implementation of Delta Debugging.
It is easier to
install than C-Reduce and also it is not as domain-specific. On the
other hand
C-Reduce is a much
more powerful reducer than Delta. C-Reduce started life as a
complementary tool to Delta: we would first run Delta until it got
stuck, then run the proto-C-Reduce, run Delta again, etc. This worked
but was cumbersome. C-Reduce has a pass that does
everything that Delta does.
-
Csmith is a random C program generator that
has been used to find a large number of compiler bugs. The requirement
to reduce Csmith programs that trigger compiler bugs, and the fact that
Delta didn't do a good enough job at it, was the reason we
created C-Reduce.
Current Projects
We are:
-
Continuing to improve C++ support. If you find C-Reduce to not work
very well for reducing C++ programs, please send us a note including a
test case.
-
Making C-Reduce support obfuscation as well as reduction. Our goal is
for users to be able to start with a proprietary or classified piece
of code, reduce it, and end up with output that can be declassified or
that does not need to be considered to be proprietary.
Feedback
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:
People