IT lexicon › Programming › Csmith

Csmith

Programming På svenska → Updated: 2026-11-07
More info
Creator
Xuejun Yang, Yang Chen, Eric Eide, John Regehr
Released
Type
Compiler testing tool
Source
github.com/csmith-project/csmith

A generator of random C programs that gets compilers to give away their miscompilations by answering the same question differently.

John Regehr's group at the University of Utah presented it at PLDI 2011. The idea is simple: generate a large, convoluted C program, compile it with several compilers at several optimisation levels, run the lot and compare the checksum each one prints. If two binaries disagree, one of them is wrong. The hard part was making the programs entirely free of undefined behaviour, since otherwise every answer is equally correct and the test means nothing.

The haul was more than 300 previously unknown bugs in GCC and LLVM, many in the optimiser's darkest corners. A bug report consisting of a random program thousands of lines long is no gift, though, so the same group wrote C-Reduce to shrink them. The legacy lives on in every compiler project that now runs fuzzing against itself.

← Back to the lexicon