paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Effect-driven QuickChecking of compilers

效应驱动的编译器 QuickChecking
ICFP 1(ICFP)2017匹配度 2/10 · 该论文属于类型与效应系统驱动的编译器差分测试,关注 OCaml 求值顺序依赖的程序生成,虽与程序语言和静态分析技术相关,但与用户当前核心方向(LLM/Agent 与静态分析交叉、浮点程序分析、贝叶斯程序分析)没有直接关联。引用 37 inbox
Jan Midtgaard, Mathias Nygaard Justesen, Patrick Kasting, Flemming Nielson, Hanne Riis Nielson
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出类型与效应系统保守检测求值顺序依赖,并据此生成程序以差分测试 OCaml 编译器后端。

如何用 QuickCheck(基于属性的测试)测试语言实现?按语法生成程序时,静态类型语言(如 OCaml)中大量候选程序会被类型检查器拒绝。已有工作按类型关系自底向上目标导向生成良类型程序,但生成程序常依赖未充分规定的求值顺序,如 OCaml、Scheme、C、C++ 等。本文提出类型与效应系统,保守检测表达式是否依赖求值顺序,并将其目标导向解读作为程序生成器,只生成与求值顺序无关的程序。作者用该生成器差分测试 OCaml 的两个编译器后端,并报告发现的多处编译器缺陷。

问题
静态类型语言中按语法随机生成程序会被类型检查器大量拒绝,且许多良类型程序仍依赖未明确定义的求值顺序,难以用于可靠的编译器测试。
方法
设计类型与效应系统保守判定求值顺序依赖,并给出该系统的目标导向、自底向上解读,以此生成与求值顺序无关的良类型程序。
评估
用生成的程序对 OCaml 的两个编译器后端做差分测试,报告发现的多处编译器 bug。
原文摘要(Abstract)

How does one test a language implementation with QuickCheck (aka. property-based testing)? One approach is to generate programs following the grammar of the language. But in a statically-typed language such as OCaml too many of these candidate programs will be rejected as ill-typed by the type checker. As a refinement Pałka et al. propose to generate programs in a goal-directed, bottom-up reading up of the typing relation. We have written such a generator. However many of the generated programs has output that depend on the evaluation order, which is commonly under-specified in languages such as OCaml, Scheme, C, C++, etc. In this paper we develop a type and effect system for conservatively detecting evaluation-order dependence and propose its goal-directed reading as a generator of programs that are independent of evaluation order. We illustrate the approach by generating programs to test OCaml's two compiler backends against each other and report on a number of bugs we have found doing so.

链接与引用

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

BibTeX
@article{MidtgaardJKNN17,
  title = {Effect-driven QuickChecking of compilers},
  author = {Jan Midtgaard and Mathias Nygaard Justesen and Patrick Kasting and Flemming Nielson and Hanne Riis Nielson},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {1},
  number = {ICFP},
  year = {2017},
  doi = {10.1145/3110259}
}