Toward general diagnosis of static errors

Danfeng Zhang, Andrew C. Myers

Research output: Chapter in Book/Report/Conference proceedingConference contribution

22 Scopus citations

Abstract

We introduce a general way to locate programmer mistakes that are detected by static analyses such as type checking. The program analysis is expressed in a constraint language in which mistakes 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 for two very different program analyses: type inference in OCaml and information flow checking in Jif. 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, the general technique identifies the location of programmer errors significantly more accurately.

Original languageEnglish (US)
Title of host publicationPOPL 2014 - Proceedings of the 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
Pages569-581
Number of pages13
DOIs
StatePublished - 2014
Event41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014 - San Diego, CA, United States
Duration: Jan 22 2014Jan 24 2014

Publication series

NameConference Record of the Annual ACM Symposium on Principles of Programming Languages
ISSN (Print)0730-8566

Other

Other41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014
CountryUnited States
CitySan Diego, CA
Period1/22/141/24/14

All Science Journal Classification (ASJC) codes

  • Software

Cite this