Automatic Program Repair by Fixing Contracts [chapter]

Yu Pei, Carlo A. Furia, Martin Nordio, Bertrand Meyer
2014 Lecture Notes in Computer Science  
While most debugging techniques focus on patching implementations, there are bugs whose most appropriate corrections consist in fixing the specification to prevent invalid executions-such as to define the correct input domain of a function. In this paper, we present a fully automatic technique that fixes bugs by proposing changes to contracts (simple executable specification elements such as pre-and postconditions). The technique relies on dynamic analysis to understand the source of buggy
more » ... ior, to infer changes to the contracts that emend the bugs, and to validate the changes against general usage. We have implemented the technique in a tool called SpecFix, which works on programs written in Eiffel, and evaluated it on 44 bugs found in standard data-structure libraries. Manual analysis by human programmers found that SpecFix suggested repairs that are deployable for 25% of the faults; in most cases, these contract repairs were preferred over fixes for the same bugs that change the implementation.
doi:10.1007/978-3-642-54804-8_17 fatcat:mthawozpeza7xbhgudlhh632k4