| 1 |
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. |
| 2 |
.TH CREDUCE "1" "March 2026" "creduce 2.11.0" "User Commands" |
| 3 |
.SH NAME |
| 4 |
creduce \- C and C++ program reducer |
| 5 |
.SH DESCRIPTION |
| 6 |
creduce 2.11.0 (81f35b4) \fB\-\-\fR a C and C++ program reducer |
| 7 |
.PP |
| 8 |
C\-Reduce requires an "interestingness test" and one or more files to |
| 9 |
reduce, which must be writable. The interestingness test is an |
| 10 |
executable program (usually a shell script) that returns 0 when a |
| 11 |
partially reduced file is interesting (a candidate for further |
| 12 |
reduction) and returns non\-zero when a partially reduced file is not |
| 13 |
interesting (not a candidate for further reduction \fB\-\-\fR all |
| 14 |
uninteresting files are discarded). |
| 15 |
.PP |
| 16 |
C\-Reduce runs the interestingness test in a fresh temporary directory |
| 17 |
containing only the partially reduced file(s). Thus, when the |
| 18 |
interestingness test examines a partially reduced file, it must do so |
| 19 |
using a relative path to the current working directory. On the other |
| 20 |
hand, when the interestingness test refers to any file that is not |
| 21 |
being reduced, this should be done using an absolute path. |
| 22 |
.PP |
| 23 |
The interestingness test should be deterministic and should not expect |
| 24 |
any command line arguments. |
| 25 |
.PP |
| 26 |
C\-Reduce can and does introduce infinite loops during |
| 27 |
reduction. Therefore, if your interestingness test runs the compiled |
| 28 |
program, this should be done under a timeout. You can implement the |
| 29 |
timeout yourself, for example using the UNIX "timeout" command, or |
| 30 |
alternatively you can give C\-Reduce a timeout (which is on by default, |
| 31 |
but is set very long: 5 minutes). An advantage of using C\-Reduce's |
| 32 |
timeout is that when a test is killed due to timing out, a message |
| 33 |
will be printed. If you do implement a timeout yourself, we recommend |
| 34 |
that your interestingness test returns exit code 124 when a subcommand |
| 35 |
times out. This will not affect the reduction but it will cause |
| 36 |
C\-Reduce to print a message stating the interestingness test |
| 37 |
reported a timeout. It is important to ensure that timeouts are not |
| 38 |
occurring too often (especially during C\-Reduce's initial passes) or |
| 39 |
else C\-Reduce will work poorly. |
| 40 |
.PP |
| 41 |
There is a particularly subtle issue regarding timeouts, which is that |
| 42 |
the interestingness test may slow down due to resource contention when |
| 43 |
C\-Reduce runs multiple copies of it on different cores. We have |
| 44 |
observed slowdowns of up to 50% due to (we suspect) cache |
| 45 |
thrashing. You must take this slowdown into account when choosing a |
| 46 |
timeout or else timeouts might occur very frequently. |
| 47 |
.PP |
| 48 |
As a quick example of an interestingness test, if you consider a file |
| 49 |
to be interesting if GCC's vectorizer fires while compiling it, you |
| 50 |
might write this shell script: |
| 51 |
.IP |
| 52 |
gcc \fB\-w\fR \fB\-O3\fR foo.c \fB\-S\fR && |
| 53 |
grep xmm foo.s |
| 54 |
.PP |
| 55 |
To see if your interestingness test is working, try running these |
| 56 |
commands: |
| 57 |
.IP |
| 58 |
DIR=`mktemp \fB\-d\fR` |
| 59 |
cp file_to_reduce [optionally, more files to reduce] $DIR |
| 60 |
cd $DIR |
| 61 |
\fI\,/path/to/interestingness_test\/\fP |
| 62 |
echo $? |
| 63 |
.PP |
| 64 |
This should result in "0" being echoed to the terminal. If this does |
| 65 |
not happen, the interestingness test is flawed and C\-Reduce won't be |
| 66 |
able to make use of it. |
| 67 |
.PP |
| 68 |
If you haven't written an interestingness test before, please refer to |
| 69 |
this tutorial for additional guidance: |
| 70 |
.IP |
| 71 |
https://embed.cs.utah.edu/creduce/using/ |
| 72 |
.PP |
| 73 |
If at all possible, run C\-Reduce on preprocessed code, generated for |
| 74 |
example using: |
| 75 |
.IP |
| 76 |
gcc \fB\-E\fR \fB\-P\fR file.c |
| 77 |
.PP |
| 78 |
If you cannot reduce preprocessed code, you can either reduce just the |
| 79 |
non\-preprocessed file or else perform a multi\-file reduction on the |
| 80 |
file and its transitive includes (or any subset of them). In the first case |
| 81 |
you need to set the CREDUCE_INCLUDE_PATH environment variable to a colonseparated list of include directories in order for clang_delta to find them. |
| 82 |
.PP |
| 83 |
If your interestingness test involves a cross compiler and the characteristics |
| 84 |
of the cross target differs from the host you will need to set |
| 85 |
CREDUCE_TARGET_TRIPLE to match the cross target. This is particularly important |
| 86 |
if you are working with non\-preprocessed code and use CREDUCE_INCLUDE_PATH. |
| 87 |
.PP |
| 88 |
Press "s" at any time to skip to the next pass (this feature is |
| 89 |
disabled unless the Perl module Term::ReadKey is available on your |
| 90 |
system). |
| 91 |
.SS "Summary of options:" |
| 92 |
.TP |
| 93 |
\fB\-\-abs\-timing\fR |
| 94 |
Print timestamps about reduction progress using |
| 95 |
absolute time |
| 96 |
.TP |
| 97 |
\fB\-\-add\-pass\fR <pass> <sub\-pass> <priority> |
| 98 |
Add the specified pass to the schedule |
| 99 |
.TP |
| 100 |
\fB\-\-also\-interesting\fR <exitcode> |
| 101 |
A process exit code (somewhere in the range 64\-113 |
| 102 |
would be usual) that, when returned by the |
| 103 |
interestingness test, will cause C\-Reduce to save a |
| 104 |
copy of the variant [default: \fB\-1]\fR |
| 105 |
.TP |
| 106 |
\fB\-\-debug\fR |
| 107 |
Print debug information |
| 108 |
.TP |
| 109 |
\fB\-\-die\-on\-pass\-bug\fR |
| 110 |
Terminate C\-Reduce if a pass encounters an otherwise |
| 111 |
non\-fatal problem |
| 112 |
.TP |
| 113 |
\fB\-\-max\-improvement\fR <bytes> |
| 114 |
Largest improvement in file size from a single |
| 115 |
transformation that C\-Reduce should accept (useful |
| 116 |
only to slow C\-Reduce down) |
| 117 |
.TP |
| 118 |
\fB\-\-n\fR <N> |
| 119 |
Number of cores to use; C\-Reduce tries to |
| 120 |
automatically pick a good setting but its choice may |
| 121 |
be too low or high for your situation |
| 122 |
.TP |
| 123 |
\fB\-\-no\-cache\fR |
| 124 |
Don't cache behavior of passes |
| 125 |
.TP |
| 126 |
\fB\-\-no\-default\-passes\fR |
| 127 |
Start with an empty pass schedule |
| 128 |
.TP |
| 129 |
\fB\-\-no\-give\-up\fR |
| 130 |
Don't give up on a pass that hasn't made progress |
| 131 |
for 50000 iterations |
| 132 |
.TP |
| 133 |
\fB\-\-no\-kill\fR |
| 134 |
Wait for parallel instances to terminate on their |
| 135 |
own instead of killing them (only useful for |
| 136 |
debugging) |
| 137 |
.TP |
| 138 |
\fB\-\-not\-c\fR |
| 139 |
Don't run passes that are specific to C and C++, use |
| 140 |
this mode for reducing other languages |
| 141 |
.TP |
| 142 |
\fB\-\-print\-diff\fR |
| 143 |
Show changes made by transformations, for debugging |
| 144 |
.TP |
| 145 |
\fB\-\-remove\-pass\fR <pass> [sub\-pass] |
| 146 |
Remove all instances of the specified pass from the |
| 147 |
schedule. |
| 148 |
.TP |
| 149 |
\fB\-\-save\-temps\fR |
| 150 |
Don't delete \fI\,/tmp/creduce\-xxxxxx\/\fP directories on |
| 151 |
termination |
| 152 |
.TP |
| 153 |
\fB\-\-shaddap\fR |
| 154 |
Suppress output about non\-fatal internal errors |
| 155 |
.TP |
| 156 |
\fB\-\-skip\-initial\-passes\fR |
| 157 |
Skip initial passes (useful if input is already |
| 158 |
partially reduced) |
| 159 |
.TP |
| 160 |
\fB\-\-skip\-key\-off\fR |
| 161 |
Disable skipping the rest of the current pass when |
| 162 |
"s" is pressed |
| 163 |
.TP |
| 164 |
\fB\-\-sllooww\fR |
| 165 |
Try harder to reduce, but perhaps take a long time |
| 166 |
to do so |
| 167 |
.TP |
| 168 |
\fB\-\-tidy\fR |
| 169 |
Do not make a backup copy of each file to reduce as |
| 170 |
file.orig |
| 171 |
.TP |
| 172 |
\fB\-\-timeout\fR |
| 173 |
Interestingness test timeout in seconds [default: |
| 174 |
300] |
| 175 |
.TP |
| 176 |
\fB\-\-timing\fR |
| 177 |
Print timestamps about reduction progress |
| 178 |
.TP |
| 179 |
\fB\-\-version\fR |
| 180 |
Print the version information |
| 181 |
.PP |
| 182 |
usage: creduce [options] interestingness_test file_to_reduce [optionally, more files to reduce] |
| 183 |
.IP |
| 184 |
creduce \fB\-\-help\fR for more information |