SHErrLoc: A static holistic error locator

Danfeng Zhang, Andrew C. Myers, Dimitrios Vytiniotis, Simon Peyton-Jones

Research output: Contribution to journalArticlepeer-review

10 Scopus citations


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.

Original languageEnglish (US)
Article number18
JournalACM Transactions on Programming Languages and Systems
Issue number4
StatePublished - Aug 2017

All Science Journal Classification (ASJC) codes

  • Software


Dive into the research topics of 'SHErrLoc: A static holistic error locator'. Together they form a unique fingerprint.

Cite this