Evaluating Trieste and QuickCheck for Generative Testing of Compiler Passes

Ludvig Sjöberg · KTH Publication Database DiVA (KTH Royal Institute of Technology) · 2026

Compilers are a foundational piece of software infrastructure, and bugs in them can silently corrupt the programs they compile. Testing compilers thoroughly is therefore important, but difficult: a compiler consists of many sequential passes, each transforming the program representation, and a bug in a pass deep in the pipeline may be hard to reach with ordinary test inputs. Generative testing can improve coverage, but when the inputs are complete source programs they tend to fail early in the compilation pipeline, before reaching the pass under test. Trieste is a compiler tool for tree rewriting that supports targeted testing of individual passes. QuickCheck is a property-based testing library that generates random values for user-defined types and checks whether specified properties hold. This thesis compares these two approaches for testing compiler passes using code coverage as the evaluation metric. The study is conducted on a compiler for the While language across all ten of its passes. QuickCheck generators were manually implemented in Haskell, producing trees that deliberately mix valid constructs with patterns designed to trigger error-handling paths. For the majority of passes, both approaches reach identical or near-identical final coverage. In one case, QuickCheck substantially outperforms Trieste because the fuzzer's random trees rarely match the specific structure the pass expects. In one other case, the reverse holds and Trieste maintains a persistent lead in function coverage. The results indicate that deliberately designed error-triggering generators allow QuickCheck to match or exceed Trieste for most passes, while Trieste remains the lower-effort default that requires no generator implementation.

Read the paper · More papers on PaperTik