paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fuzzing C++ Compilers via Type-Driven Mutation

基于类型驱动变异的 C++ 编译器模糊测试
OOPSLA 9(OOPSLA2)2025匹配度 3/10 · 论文属于编译器模糊测试与类型系统,虽与 PL/程序分析相关,但不涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,也未聚焦 ML 系统/Agentic 程序的静态分析,因此与画像核心方向匹配度较低。引用 5 inbox
Bo Wang, Chong Chen, Ming Deng, Junjie Chen, Xing Zhang, Youfang Lin, Dan Hao, Jun Sun
crossref: 2026-09-10

AI 速览

一句话:提出首个面向 C++ 类型系统的变异式编译器模糊测试方法 TyMut,通过类型驱动变异与 must 分析发现 102 个编译器缺陷。

C++ 多范式特性使其类型系统极为复杂,但针对 C++ 编译器类型系统的系统化测试仍很缺乏。本文提出 TyMut,首个专门测试 C++ 类型系统的变异式编译器模糊测试方法。它设计类型驱动变异算子,覆盖模板泛型、类型转换与继承等复杂特性;并区分良构与不良构算子,结合 must 分析和良构性规则为近 80% 的生成程序提供确定预言,其余用差分测试检测编译器间行为不一致。约 32 小时测试生成并运行 250584 个程序,在 GCC 与 Clang 中发现 102 个缺陷,56 个被确认,26 个导致崩溃,超过 50% 导致误编译;部分缺陷隐藏超 20 年,还发现 TensorFlow 实际问题的根因,并揭示了 C++ 语言规范的歧义。

问题
C++ 类型系统涵盖类型推断、类型检查、子类型、类型转换、泛型、作用域与绑定等复杂特性,但现有研究缺乏对 C++ 编译器类型系统的系统化测试。
方法
TyMut 设计类型驱动的良构与不良构变异算子,结合 must 分析与良构性规则提供确定测试预言,并对无定论程序使用差分测试检测编译器间行为不一致。
评估
在约 32 小时内生成并测试 250584 个程序,must 分析为近 80% 的程序提供确定预言;在 GCC 与 Clang 最新版本中发现 102 个缺陷,其中 56 个被确认,包含 26 个崩溃和超过 50% 的误编译,部分缺陷隐藏超过 20 年。
原文摘要(Abstract)

C++ is a system-level programming language for modern software development, which supports multiple programming paradigms, including object-oriented, generic, and functional programming. The intrinsic complexity of these paradigms and their interactions grants C++ powerful expressiveness while posing significant challenges for compilers in correctly implementing its type system. A type system encompasses various aspects such as type inference, type checking, subtyping, type conversions, generics, scoping, and binding. However, systematic testing of the type systems of C++ compilers remains largely underexplored in existing studies. In this work, we present TyMut, the first approach specifically designed to test the C++ type system. TyMut is a mutation-based compiler fuzzer equipped with advanced type-driven mutation operators, carefully crafted to target intricate type-related features such as template generics, type conversions, and inheritance. Beyond differential testing, TyMut introduces enhanced test oracles through a must analysis that partially confirms the validity of generated programs. Specifically, mutation operators are classified into well-formed and not-well-formed : Programs generated by well-formed mutation operators are valid and must be accepted by compilers. Programs generated by not-well-formed operators are validated against a set of well-formedness rules . Any violation indicates the program is invalid and must be rejected. For programs that pass the rules but lack a definitive oracle, TyMut applies differential testing to identify behavioral inconsistencies across compilers. The testing campaign took about 32 hours to generate and test 250584 programs. The must analysis provides definite test oracles for nearly 80% of all generated programs. TyMut uncovered 102 bugs in the recent versions of GCC and Clang, with 56 confirmed as new bugs by compiler developers. Among the confirmed bugs, 26 of them cause compiler crashes, and more than 50% cause miscompilation. Additionally, 7 of them had remained hidden for over 20 years, 22 for over 10 years, and 39 for over 5 years. One long-standing bug discovered by TyMut was later confirmed as the root cause of a real-world issue in TensorFlow. Before submitting this paper, 13 bugs were fixed, most of which were fixed within 60 days. Notably, some unconfirmed bugs have led to in-depth discussions among developers. For instance, one bug led a compiler developer to submit a new issue to the C++ language standard, showing that we uncovered ambiguities in the language specification.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2934,
  title = {Fuzzing C++ Compilers via Type-Driven Mutation},
  author = {Bo Wang and Chong Chen and Ming Deng and Junjie Chen and Xing Zhang and Youfang Lin and Dan Hao and Jun Sun},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3763094}
}