🤖 AI Summary
This paper addresses the challenge of automated repair of C programs by proposing the first closed-loop framework that integrates spectrum-based fault localization (SBFL) with large language model (LLM)-driven chain-of-thought (CoT) reasoning. Methodologically, the approach employs runtime test feedback to drive iterative refinement: SBFL initially identifies suspicious statements; an LLM generates patches using structured CoT prompting; and execution feedback guides successive improvements until all tests pass. The key contribution lies in the explicit coupling of statistical program analysis with symbolic LLM reasoning—enhancing fault attribution accuracy and mitigating recurrent patch failures. Evaluated on the Codeflaws benchmark (3,902 defects), the method achieves a repair accuracy of 44.93%, outperforming the GPT-4+CoT baseline by 3.61%, thereby validating the efficacy of analysis-guided iterative reasoning for program repair.
📝 Abstract
This study explores the potential of Large Language Models (LLMs) in automating the repair of C programs. We present a framework that integrates spectrum-based fault localization (SBFL), runtime feedback, and Chain-of-Thought-structured prompting into an autonomous repair loop. Unlike prior approaches, our method explicitly combines statistical program analysis with LLM reasoning. The iterative repair cycle leverages a structured Chain-of-Thought (CoT) prompting approach, where the model reasons over failing tests, suspicious code regions, and prior patch outcomes, before generating new candidate patches. The model iteratively changes the code, evaluates the results, and incorporates reasoning from previous attempts into subsequent modifications, reducing repeated errors and clarifying why some bugs remain unresolved. Our evaluation spans 3,902 bugs from the Codeflaws benchmark, where our approach achieves 44.93% repair accuracy, representing a 3.61% absolute improvement over strong state-of-the-art APR baselines such as GPT-4 with CoT. This outcome highlights a practical pathway toward integrating statistical program analysis with generative AI in automated debugging.