Boosting Compiler Testing by Injecting Real-World Code
Shaohua Li, Theodoros Theodoridis, Zhendong Su
Abstract
We introduce a novel approach for testing optimizing compilers with code from real-world applications. The main idea is to construct well-formed programs by fusing multiple code snippets from various realworld projects. The key insight is backed by the fact that the large volume of real-world code exercises rich syntactical and semantic language features, which current engineering-intensive approaches like random program generators are hard to fully support. To construct well-formed programs from real-world code, our approach works by (1) extracting real-world code at the granularity of function, (2) injecting function calls into seed programs, and (3) leveraging dynamic execution information to maintain the semantics and build complex data dependencies between injected functions and the seed program. With this idea, our approach complements the existing generators by boosting their expressiveness via fusing real-world code in a semantics-preserving way.
We implement our idea in a tool, Creal, to test C compilers. In a nine-month testing period, we have reported 132 bugs to GCC and LLVM, two of the most popular and well-tested C compilers. At the time of writing, 121 of them have been confirmed as unknown bugs, and 101 of them have been fixed. Most of these bugs were miscompilations, and many were recognized as long-latent and critical. Our evaluation results evidently demonstrate the significant advantage of using real-world code to stress-test compilers. We believe this idea will benefit the general compiler testing direction and will be directly applicable to other compilers.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
18 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Validating JIT Compilers via Compilation Space Exploration cites Random testing for C and C++ compilers with YARPGen
- Validating JIT Compilers via Compilation Space Exploration cites Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Once4All: Skeleton-Guided SMT Solver Fuzzing with LLM-Synthesized Generators cites Validating JIT Compilers via Compilation Space Exploration
- GrayC: Greybox Fuzzing of Compilers and Analysers for C cites Random testing for C and C++ compilers with YARPGen
- Interleaving Large Language Models for Compiler Testing cites GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Interleaving Large Language Models for Compiler Testing cites Random testing for C and C++ compilers with YARPGen
- Interleaving Large Language Models for Compiler Testing cites Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Interleaving Large Language Models for Compiler Testing cites UBFuzz: Finding Bugs in Sanitizer Implementations
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration cites Validating JIT Compilers via Compilation Space Exploration
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration cites GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration cites Random testing for C and C++ compilers with YARPGen
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration cites Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration cites UBFuzz: Finding Bugs in Sanitizer Implementations
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation cites GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation cites Random testing for C and C++ compilers with YARPGen
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation cites Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation cites UBFuzz: Finding Bugs in Sanitizer Implementations
- UBFuzz: Finding Bugs in Sanitizer Implementations cites Random testing for C and C++ compilers with YARPGen
Cited by top-tier papers18
- Validating JIT Compilers via Compilation Space ExplorationCong Li, Yanyan Jiang, Chang Xu, Zhendong SuSOSP 2023 · 22 citations
- Unveiling Compiler Faults via Attribute-Guided Compilation Space ExplorationJiangchang Wu, Yibiao Yang, Maolin Sun, Yuming ZhouUSENIX ATC 2025 · 6 citations
- Optimization-Directed Compiler Fuzzing for Continuous Translation ValidationJaeseong Kwon, Bongjun Jang, Juneyoung Lee, Kihong HeoPLDI 2025 · 5 citations
- Interleaving Large Language Models for Compiler TestingYunbo Ni, Shaohua LiOOPSLA 2025 · 4 citations
- Once4All: Skeleton-Guided SMT Solver Fuzzing with LLM-Synthesized GeneratorsMaolin Sun, Yibiao Yang, Yuming ZhouASPLOS 2026 · 1 citation
Builds on6
- Random testing for C and C++ compilers with YARPGenVsevolod Livinskii, Dmitry Babokin, John RegehrOOPSLA 2020 · 140 citations
- Free Lunch for Testing: Fuzzing Deep-Learning Libraries from Open SourceAnjiang Wei, Yinlin Deng, Chenyuan Yang, Lingming ZhangICSE 2022 · 91 citations
- GrayC: Greybox Fuzzing of Compilers and Analysers for CKarine Even-Mendoza, Arindam Sharma, Alastair F. Donaldson, Cristian CadarISSTA 2023 · 52 citations
- Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel LanguagesVsevolod Livinskii, Dmitry Babokin, John RegehrPLDI 2023 · 42 citations
- UBFuzz: Finding Bugs in Sanitizer ImplementationsShaohua Li, Zhendong SuASPLOS 2024 · 8 citations
Related papers
- Enriching Compiler Testing with Real Program from Bug ReportHao ZhongASE 2022 · 24 citations
- FLUX: Finding Bugs with LLVM IR Based Unit Test CrossoversEric Liu, Shengjie Xu, David LieASE 2023 · 8 citations
- CombCT: Compiler Testing via Combinatorial TestingChuan Luo, Shaoke Cui, Jiahao Yan, Junjie Chen et al.ICSE 2026
- Semantic Reification: A New Paradigm for Random Program GenerationKavya Chopra, Cong Li, Thodoris Sotiropoulos, Zhendong SuPLDI 2026
- Seeking Evidence of Further Optimization: Detecting Missed Optimizations through Compiler’s Native AnalysesYi Zhang, Yu Wang, Ke Wang, Linzhang WangOOPSLA 2026
