paperbot · PL 论文追踪

全部论文 待读 收藏

P1 SHErrLoc

SHErrLoc:定位静态分析检测到的程序员错误
TOPLAS 39(4)2017匹配度 5/10 · 论文属于静态分析中的错误定位,采用约束不可满足性与贝叶斯解释,契合你关注的“贝叶斯程序分析”方向;但它完全不涉及 LLM/Agent、ML 系统或浮点程序分析,与当前主线的 LLM 交叉点距离较远。引用 12 inbox
Danfeng Zhang, Andrew C. Myers, Dimitrios Vytiniotis, Simon Peyton-Jones
dblp: 2026-09-10crossref: 2026-09-10

AI 速览

一句话:提出基于约束不可满足性和贝叶斯解释的通用错误定位方法,并实现工具 SHErrLoc。

论文研究如何定位由静态分析发现的程序员错误。作者用通用约束语言表达类型检查、信息流、数据流和指针分析等,将错误视为约束系统不可满足;在“程序大多正确”的假设下,分析可满足与不可满足约束,按贝叶斯原则选择最简错误解释,并识别可能遗漏的假设。实现为 SHErrLoc,并在三种不同分析上评估,包括 GHC 高度表达类型系统的类型推断(类型类、GADT、类型族)。使用已有含错程序对比现有编译器和工具,SHErrLoc 无需语言特定启发式即可更准确地定位错误。

问题
静态分析报错时,如何通用地定位导致不可满足约束的程序表达式,而不依赖语言特定启发式。
方法
用通用约束语言统一建模多种分析,基于贝叶斯原则比较可满足与不可满足约束,选择最简错误解释并推断可能遗漏的假设。
评估
将 SHErrLoc 应用于 GHC 类型推断等三类分析,在已有含错程序上与现有编译器和工具比较错误定位准确率。
原文摘要(Abstract)

We introduce a general way to locate programmer mistakes that are detected by static analyses. The program analysis is expressed in a general constraint language that is powerful enough to model type checking, information flow analysis, dataflow analysis, and points-to analysis. Mistakes in program analysis result in unsatisfiable constraints. Given an unsatisfiable system of constraints, both satisfiable and unsatisfiable constraints are analyzed to identify the program expressions most likely to be the cause of unsatisfiability. The likelihood of different error explanations is evaluated under the assumption that the programmer’s code is mostly correct, so the simplest explanations are chosen, following Bayesian principles. For analyses that rely on programmer-stated assumptions, the diagnosis also identifies assumptions likely to have been omitted. The new error diagnosis approach has been implemented as a tool called SHErrLoc, which is applied to three very different program analyses, such as type inference for a highly expressive type system implemented by the Glasgow Haskell Compiler—including type classes, Generalized Algebraic Data Types (GADTs), and type families. The effectiveness of the approach is evaluated using previously collected programs containing errors. The results show that when compared to existing compilers and other tools, SHErrLoc consistently identifies the location of programmer errors significantly more accurately, without any language-specific heuristics.

链接与引用

DOI 原文 · DBLP

BibTeX
@article{ZhangMVJ17,
  title = {SHErrLoc},
  author = {Danfeng Zhang and Andrew C. Myers and Dimitrios Vytiniotis and Simon Peyton-Jones},
  journal = {ACM Transactions on Programming Languages and Systems},
  volume = {39},
  number = {4},
  year = {2017},
  doi = {10.1145/3121137}
}