paperbot · PL 论文追踪

全部论文 待读 收藏

P2 LLM-Based Code Generation Method for Golang Compiler Testing

基于 LLM 的 Golang 编译器测试代码生成方法
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 3/10 · 论文属于 LLM 用于编译器测试/模糊测试的代码生成,虽与程序语言和机器学习交叉相关,但未涉及用户核心关注的静态分析、Agentic 程序、浮点程序分析或贝叶斯程序分析。方法偏测试用例生成,与研究方向仅边缘相关。引用 145 inbox
Qiuhan Gu
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出基于 LLM 的 Golang 编译器测试代码生成方法,通过过滤与种子调度提升用例质量与数量。

现代优化编译器异常复杂,模糊测试是发现其细微缺陷的关键手段,但传统测试用例生成方法在覆盖率和数量上有限。本文提出基于 LLM 的编译器测试代码生成方法,以同时提升生成用例的质量与数量。方法包含过滤策略,用于清洗源码、避免未定义行为与语法错误,并为模型训练准备高质量数据集;还提出种子调度策略改进代码生成。作者将该方法用于测试 Golang 编译器。评估显示,其流水线在质量和数量上均优于先前方法:生成用例平均覆盖率为 3.38%,而 GoFuzz 仅为 0.44%;仅 2.79% 的用例出现语法错误,且无未定义行为。

问题
现代优化编译器复杂,模糊测试效果依赖测试用例的质量与数量;传统生成方法在覆盖率与数量上有限。
方法
提出基于 LLM 的测试代码生成方法,使用过滤策略清洗源码以避免未定义行为和语法错误并构建高质量训练集,并用种子调度策略改进生成。
评估
在 Golang 编译器测试中评估,与 GoFuzz 比较平均覆盖率和生成用例的语法错误/未定义行为比例。
原文摘要(Abstract)

Modern optimizing compilers are among the most complex software systems humans build. One way to identify subtle compiler bugs is fuzzing. Both the quantity and the quality of testcases are crucial to the performance of fuzzing. Traditional testcase-generation methods, such as Csmith and YARPGen, have been proven successful at discovering compiler bugs. However, such generated testcases have limited coverage and quantity. In this paper, we present a code generation method for compiler testing based on LLM to maximize the quality and quantity of the generated code. In particular, to avoid undefined behavior and syntax errors in generated testcases, we design a filter strategy to clean the source code, preparing a high-quality dataset for the model training. Besides, we present a seed schedule strategy to improve code generation. We apply the method to test the Golang compiler and the result shows that our pipeline outperforms previous methods both qualitatively and quantitatively. It produces testcases with an average coverage of 3.38%, in contrast to the testcases generated by GoFuzz, which have an average coverage of 0.44%. Moreover, among all the generated testcases, only 2.79% exhibited syntax errors, and none displayed undefined behavior.

链接与引用

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

BibTeX
@inproceedings{Gu23,
  title = {LLM-Based Code Generation Method for Golang Compiler Testing},
  author = {Qiuhan Gu},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3617850}
}