Framing Program Repair as Code Completion

被引:3
作者
Ribeiro, Francisco [1 ]
Abreu, Rui [2 ,3 ]
Saraiva, Joao [1 ]
机构
[1] Univ Minho, HASLab INESC TEC, Braga, Portugal
[2] Univ Porto, INESC ID, Porto, Portugal
[3] Univ Porto, FEUP, Porto, Portugal
来源
INTERNATIONAL WORKSHOP ON AUTOMATED PROGRAM REPAIR (APR 2022) | 2022年
基金
美国安德鲁·梅隆基金会;
关键词
program repair; code generation; code completion;
D O I
10.1145/3524459.3527347
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Many techniques have contributed to the advancement of automated program repair, such as: generate and validate approaches, constraint-based solvers and even neural machine translation. Simultaneously, artificial intelligence has allowed the creation of general-purpose pre-trained models that support several downstream tasks. In this paper, we describe a technique that takes advantage of a generative model - CodeGPT - to automatically repair buggy programs by making use of its code completion capabilities. We also elaborate on where to perform code completion in a buggy line and how we circumvent the open-ended nature of code generation to appropriately fit the new code in the original program. Furthermore, we validate our approach on the ManySStuBs4j dataset containing real-world open-source projects and show that our tool is able to fix 1739 programs out of 6415 - a 27% repair rate. The repaired programs range from single-line changes to multiple line modifications. In fact, our technique is able to fix programs which were missing relatively complex expressions prior to being analyzed. In the end, we present case studies that showcase different scenarios our technique was able to handle.
引用
收藏
页码:38 / 45
页数:8
相关论文
共 30 条
  • [1] Evolutionary repair of faulty software
    Arcuri, Andrea
    [J]. APPLIED SOFT COMPUTING, 2011, 11 (04) : 3494 - 3514
  • [2] Barr Earl T., 2015, ISSTA 2015
  • [3] Learning from Examples to Improve Code Completion Systems
    Bruch, Marcel
    Monperrus, Martin
    Mezini, Mira
    [J]. 7TH JOINT MEETING OF THE EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND THE ACM SIGSOFT SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, 2009, : 213 - 222
  • [4] Campos J, 2012, IEEE INT CONF AUTOM, P378, DOI 10.1145/2351676.2351752
  • [5] SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repair
    Chen, Zimin
    Kommrusch, Steve
    Tufano, Michele
    Pouchet, Louis-Noel
    Poshyvanyk, Denys
    Monperrus, Martin
    [J]. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2021, 47 (09) : 1943 - 1959
  • [6] HINTS ON TEST DATA SELECTION - HELP FOR PRACTICING PROGRAMMER
    DEMILLO, RA
    LIPTON, RJ
    [J]. COMPUTER, 1978, 11 (04) : 34 - 41
  • [7] Devlin J., 2019, North American Chapter of the Association for Computational Linguistics, V1, P4171, DOI [DOI 10.48550/ARXIV.1810.04805, DOI 10.18653/V1/N19-1423, 10.48550/ARXIV.1810.04805]
  • [8] Patching as Translation: the Data and the Metaphor
    Ding, Yangruibo
    Ray, Baishakhi
    Devanbu, Premkumar
    Hellendoorn, Vincent J.
    [J]. 2020 35TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING (ASE 2020), 2020, : 275 - 286
  • [9] Durieux T, 2016, 2016 IEEE/ACM 11TH INTERNATIONAL WORKSHOP IN AUTOMATION OF SOFTWARE TEST (AST), P85, DOI [10.1109/AST.2016.021, 10.1145/2896921.2896931]
  • [10] Feng ZY, 2020, Arxiv, DOI [arXiv:2002.08155, 10.48550/arXiv.2002.08155]