Boosting Compiler Testing by Injecting Real-World Code
Shaohua Li, Theodoros Theodoridis, Zhendong Su
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 18 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Validating JIT Compilers via Compilation Space Exploration 引用了 Random testing for C and C++ compilers with YARPGen
- Validating JIT Compilers via Compilation Space Exploration 引用了 Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Once4All: Skeleton-Guided SMT Solver Fuzzing with LLM-Synthesized Generators 引用了 Validating JIT Compilers via Compilation Space Exploration
- GrayC: Greybox Fuzzing of Compilers and Analysers for C 引用了 Random testing for C and C++ compilers with YARPGen
- Interleaving Large Language Models for Compiler Testing 引用了 GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Interleaving Large Language Models for Compiler Testing 引用了 Random testing for C and C++ compilers with YARPGen
- Interleaving Large Language Models for Compiler Testing 引用了 Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Interleaving Large Language Models for Compiler Testing 引用了 UBFuzz: Finding Bugs in Sanitizer Implementations
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration 引用了 Validating JIT Compilers via Compilation Space Exploration
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration 引用了 GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration 引用了 Random testing for C and C++ compilers with YARPGen
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration 引用了 Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Unveiling Compiler Faults via Attribute-Guided Compilation Space Exploration 引用了 UBFuzz: Finding Bugs in Sanitizer Implementations
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation 引用了 GrayC: Greybox Fuzzing of Compilers and Analysers for C
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation 引用了 Random testing for C and C++ compilers with YARPGen
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation 引用了 Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel Languages
- Optimization-Directed Compiler Fuzzing for Continuous Translation Validation 引用了 UBFuzz: Finding Bugs in Sanitizer Implementations
- UBFuzz: Finding Bugs in Sanitizer Implementations 引用了 Random testing for C and C++ compilers with YARPGen
引用它的顶会 Paper18
- Validating JIT Compilers via Compilation Space ExplorationCong Li, Yanyan Jiang, Chang Xu, Zhendong SuSOSP 2023 · 22 次引用
- Unveiling Compiler Faults via Attribute-Guided Compilation Space ExplorationJiangchang Wu, Yibiao Yang, Maolin Sun, Yuming ZhouUSENIX ATC 2025 · 6 次引用
- Optimization-Directed Compiler Fuzzing for Continuous Translation ValidationJaeseong Kwon, Bongjun Jang, Juneyoung Lee, Kihong HeoPLDI 2025 · 5 次引用
- Interleaving Large Language Models for Compiler TestingYunbo Ni, Shaohua LiOOPSLA 2025 · 4 次引用
- Once4All: Skeleton-Guided SMT Solver Fuzzing with LLM-Synthesized GeneratorsMaolin Sun, Yibiao Yang, Yuming ZhouASPLOS 2026 · 1 次引用
它引用的 Paper6
- Random testing for C and C++ compilers with YARPGenVsevolod Livinskii, Dmitry Babokin, John RegehrOOPSLA 2020 · 140 次引用
- Free Lunch for Testing: Fuzzing Deep-Learning Libraries from Open SourceAnjiang Wei, Yinlin Deng, Chenyuan Yang, Lingming ZhangICSE 2022 · 91 次引用
- GrayC: Greybox Fuzzing of Compilers and Analysers for CKarine Even-Mendoza, Arindam Sharma, Alastair F. Donaldson, Cristian CadarISSTA 2023 · 52 次引用
- Fuzzing Loop Optimizations in Compilers for C++ and Data-Parallel LanguagesVsevolod Livinskii, Dmitry Babokin, John RegehrPLDI 2023 · 42 次引用
- UBFuzz: Finding Bugs in Sanitizer ImplementationsShaohua Li, Zhendong SuASPLOS 2024 · 8 次引用
相关 Paper
- Enriching Compiler Testing with Real Program from Bug ReportHao ZhongASE 2022 · 24 次引用
- FLUX: Finding Bugs with LLVM IR Based Unit Test CrossoversEric Liu, Shengjie Xu, David LieASE 2023 · 8 次引用
- CombCT: Compiler Testing via Combinatorial TestingChuan Luo, Shaoke Cui, Jiahao Yan, Junjie Chen 等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
