Csmith
Csmith is a free, open-source generator of random C programs used to look for compiler bugs through differential testing.
What Csmith is
Csmith is a free, open-source generator of random C programs used to look for compiler bugs through differential testing. It produces programs designed to avoid undefined behavior and includes statistics for each one. A documented workflow compiles generated programs with GCC and Clang and compares their outputs to help reveal compiler bugs. The project also suggests using Csmith to create material for a C-program test suite when users do not want to write one themselves. Command-line options displayed by `csmith -h` and `csmith -hh` let users customize random generation. Csmith runs locally on Linux and Windows. For Linux source builds, the Ubuntu instructions list g++, CMake, and m4; Windows build guidance covers Visual Studio or WSL. The project says it should build on most modern machines with a C++ compiler. Generated programs can contain infinite loops, so execution should be bounded with timeouts. The repository includes a COPYING license file. Bug reports and suggestions go to GitHub issues, and a mailing list is available for discussion; maintainers note replies may be delayed because they maintain the project in discretionary time.
Good
- Generates C programs without undefined behavior.
- Supports output comparison with GCC and Clang.
- Command-line options customize generation.
- Runs locally on Linux and Windows.
- Free and open-source.
Watch out
- Generated programs may contain infinite loops.
- Maintainer responses may be delayed.
- Linux source builds require g++, CMake, and m4.
Who it suits
Csmith is suited to compiler developers or testers who need generated C programs for differential testing or test suites. It also fits users comfortable building and running command-line tools locally.
Verdict
Csmith provides a focused way to generate C inputs and compare compiler behavior. Use timeouts when executing its output, and account for potentially delayed project responses.
Plans and prices
From Csmith's own pricing page, checked 4 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Csmith | Free | Open-source C program generator |
The facts
Each one read from Csmith's own pages, with the date it was checked.
What it does
- Build compatibility
- The INSTALL file says Csmith should build on most modern machines with a C++ compiler.checked 4 Oct 2026
- Compiler workflow
- The README demonstrates compiling generated programs with GCC and Clang and comparing their outputs to identify compiler bugs.checked 4 Oct 2026
- Customization
- Command-line options shown by `csmith -h` and `csmith -hh` customize random generation.checked 4 Oct 2026
- Execution limit
- Generated programs might contain infinite loops, and the README recommends applying timeouts to their execution.checked 4 Oct 2026
- License
- The repository includes a COPYING license file.checked 4 Oct 2026
- Origin
- Csmith was originally developed at the University of Utah as part of a compiler-testing research project and was open-sourced in 2009.checked 4 Oct 2026
- Other use
- The project suggests using Csmith to create a C-program test suite when users do not want to write one themselves.checked 4 Oct 2026
- Purpose
- Csmith generates random C programs to find compiler bugs using differential testing.checked 4 Oct 2026
- Safe output
- Generated C programs are free of undefined behaviors and include per-program statistics.checked 4 Oct 2026
- Support
- The project directs users to GitHub issues for bug reports and suggestions and provides a mailing list for discussion.checked 4 Oct 2026
- Support response
- The maintainers say they maintain Csmith in their discretionary time and responses to bug reports or feature requests may be delayed.checked 4 Oct 2026
Where it runs
- Linux build
- The Ubuntu build instructions list g++, CMake, and m4 as prerequisites and use CMake and make to install from source.checked 4 Oct 2026
- Windows build
- The project documents building on Windows with Visual Studio or WSL.checked 4 Oct 2026
Alternatives to Csmith
- 1
Jazzer
Free planOpen sourceAPILinuxmacOSSelf-hosted7.3Free plan - 2
AFL++
Free planAndroidLinuxmacOSSelf-hosted7.2From €20,000 a year - 3

Mayhem
Free planWebAPILinuxmacOS7.0From $236 a month - 4

ClusterFuzz
Free planWebLinuxmacOSSelf-hosted6.8Free plan - 5
cargo-fuzz
Free planLinuxmacOSWindows6.7Free plan - 6
boofuzz
Free planAPILinuxSelf-hostedWindows6.4Free plan
