Skip to content
SPECIFICTION
Get listed

Csmith

github.com

Free plan WindowsLinux
Visit github.com
Spec score 7.8 #12 of 26 in Fuzz Testing Software

What it is

Csmith is a free, open-source generator of random C programs for finding compiler bugs through differential testing. Its output avoids undefined behavior and includes statistics for each generated program. A documented workflow compiles programs with GCC and Clang, then compares their outputs to identify differences. The tool can also create material for a C test suite when users do not want to write one themselves. Command-line options shown by csmith -h and csmith -hh customize random generation. Csmith runs locally on Linux and Windows. Ubuntu source builds require g++, CMake, and m4, followed by CMake and make; Windows builds are documented with Visual Studio or WSL. The project says it should build on most modern machines with a C++ compiler. Generated programs may loop indefinitely, so execution timeouts are recommended. The repository includes a COPYING license file. Bug reports and suggestions go through GitHub issues, with discussion on a mailing list; maintainers warn replies may be delayed.

Spec sheet

Purpose
Csmith generates random C programs to find compiler bugs using differential testing.Read 4 Oct 2026 · github.com
Support
The project directs users to GitHub issues for bug reports and suggestions and provides a mailing list for discussion.Read 4 Oct 2026 · github.com
License
The repository includes a COPYING license file.Read 4 Oct 2026 · github.com
Build compatibility
The INSTALL file says Csmith should build on most modern machines with a C++ compiler.Read 4 Oct 2026 · github.com
Compiler workflow
The README demonstrates compiling generated programs with GCC and Clang and comparing their outputs to identify compiler bugs.Read 4 Oct 2026 · github.com
Customization
Command-line options shown by `csmith -h` and `csmith -hh` customize random generation.Read 4 Oct 2026 · github.com
Execution limit
Generated programs might contain infinite loops, and the README recommends applying timeouts to their execution.Read 4 Oct 2026 · github.com
Linux build
The Ubuntu build instructions list g++, CMake, and m4 as prerequisites and use CMake and make to install from source.Read 4 Oct 2026 · github.com
Origin
Csmith was originally developed at the University of Utah as part of a compiler-testing research project and was open-sourced in 2009.Read 4 Oct 2026 · github.com
Other use
The project suggests using Csmith to create a C-program test suite when users do not want to write one themselves.Read 4 Oct 2026 · github.com
Safe output
Generated C programs are free of undefined behaviors and include per-program statistics.Read 4 Oct 2026 · github.com
Support response
The maintainers say they maintain Csmith in their discretionary time and responses to bug reports or feature requests may be delayed.Read 4 Oct 2026 · github.com
Windows build
The project documents building on Windows with Visual Studio or WSL.Read 4 Oct 2026 · github.com

Plans and prices

Csmith Free Open-source C program generator Read 4 Oct 2026 · github.com

Every Csmith plan and price →

Strong points and limits

Strong points

  • Generates C programs without undefined behavior
  • Includes per-program statistics
  • Supports GCC and Clang output comparison
  • Runs locally on Linux and Windows
  • Command-line options customize generation

Limits

  • Generated programs may contain infinite loops
  • Linux builds require g++, CMake, and m4
  • Maintainer responses may be delayed

Who it suits

Csmith suits compiler developers and testers who need generated C programs for differential testing or test suites. It is also useful when local Linux or Windows execution is preferred.

Verdict

Csmith focuses narrowly on compiler testing through generated C programs and differential comparison. It is free and configurable, but users must manage builds and apply timeouts when executing output.

Where Specifiction places it

Alternatives to CsmithAll alternatives →