## The Impact of Program Reduction on Automated Program Repair

Linas Vidziunas Simula Research Laboratory Oslo, Norway linasvidz@simula.no

David Binkley Loyola University Maryland Baltimore, MD, USA binkley@cs.loyola.edu

Leon Moonen Simula Research Laboratory &amp; BI Norwegian Business School Oslo, Norway leon.moonen@computer.org

Abstract -Correcting bugs using modern Automated Program Repair (APR) can be both time-consuming and resourceexpensive. We describe a program repair approach that aims to improve the scalability of modern APR tools. The approach leverages program reduction in the form of program slicing to eliminate code irrelevant to fixing the bug, which improves the APR tool's overall performance. We investigate slicing's impact on all three phases of the repair process: fault localization, patch generation, and patch validation. Our empirical exploration finds that the proposed approach on average enhances the repair ability of the TBar APR tool, but we also discovered a few cases where it was less successful. Specifically, on examples from the widely used Defects4J dataset, we obtain a substantial reduction in median repair time, which falls from 80 minutes to just under 18 minutes. We conclude that program reduction can improve the performance of APR without degrading repair quality, but this improvement is not universal.

Index Terms -automated program repair, dynamic program slicing, fault localization, test-suite reduction, hybrid techniques.

## I. INTRODUCTION

Automated program repair (APR) is an active research area with growing tool support [1, 2]. However, APR struggles with scalability as it grows resource-intensive and time-consuming for larger programs. Of its three phases, fault localization, patch generation, and patch validation, this struggle is more pronounced in the first and third phases. For example, poor performance in the first phase can lead to poor overall performance because the actual faulty statement is found far down the list of suspicious statements [3, 4], leading to what has been termed the 'patch explosion' problem.

This paper aims to study the improvement possible using program reduction, specifically, that made possible through program slicing. Fixing a reduced program instead of the original program is expected to provide benefits to all three phases. For example, fault localization should be more focused when working with the reduced program. The impact on patch generation is less direct. The reduced program is, de facto, more cohesive, than the original program; thus, sampling potential patches from the reduced program should provide a higher probability of success. Finally, running the simpler reduced program should lower patch validation time. This is especially true because we introduce a test-suite reduction technique based on the reduced program. As others have noted, for test-based APR, the cost of patch validation depends

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-a5f1a740-14ba-4a0e-9a64-845d18fc7c6e.jpg)

heavily on the size of the test suite, while at the same time, much of a test suite is irrelevant to fixing a given bug [2, 5].

To demonstrate the effectiveness of combining program reduction and APR we use TBar [6], a state-of-the-art templatebased APR tool, and select bugs from the widely studied Defects4J dataset [7]. We choose template-based APR because it is one of the most effective approaches for generating patches [3]. We use Defects4J to illustrate the effectiveness of our approach on several real applications and to facilitate comparison with previous work [7].

Significance and Impact: Empirical evidence [8-10] has shown that finding a valid patch often requires exploring a significant proportion of the patch space, which can grow quite expensive. We aim to show how a reduced program, such as that produced by program slicing, can effectively identify and eliminate code and tests that are irrelevant to the patching of a bug without adversely affecting the quality of the repair. Thus, in essence, we aim to improve program repair by reducing the size of the program being repaired. Two things are essential to this process. First, the reduced program must replicate the erroneous behavior of the bug being repaired, and, second, a patch for the reduced program must also be a patch for the original program. Satisfying these two requirements expands the set of programs to which modern APR tools can be applied. Contributions: This paper makes the following contributions:

- ⋆ We empirically investigate the impact of program reduction on the three phases of automated program repair: fault localization, patch generation, and patch validation.
- ⋆ We discuss a dynamic procedure for test-suite reduction that is based on program reduction and introduce a new metric NTE (Number of Tests Executed) to study the impact that program reduction has on patch validation.
- ⋆ We consider eight configurations that involve combinations of a reduced program, a reduced test suite, and a reduced suspicious-locations list.
- ⋆ Our results show a reduction in TBar's runtime without degrading its repair quality. On examples from the widely studied Defects4J dataset, we obtain substantial reductions that approach an order of magnitude.
- ⋆ To support open science, we make a replication package available via Zenodo. 1

1 https://doi.org/10.5281/zenodo.13074333

## II. MOTIVATING EXAMPLE

Consider the repair of Defects4J [7] bug Lang-10 using the TBar APR tool [6]. It takes TBar eight hours to find a plausible patch for this bug. During this time, it examines 1938 incorrect patches. The long processing time can be explained by the following observations. First, TBar spends significant time mutating suspicious statements that are not the actual faulty statement: fault location returns a ranked list of 261 suspicious statements, on which the faulty location has Rank 82. Second, the test suite for this bug includes two failing tests and 2196 passing tests, most of which are irrelevant to fixing the bug; thus, they can be omitted without adversely affecting the quality of the repair while saving considerable time. Applying our technique the faulty location improves to Rank 64. Furthermore, test-suite reduction reduces the test suite to 73 passing tests, greatly reducing the patch validation expense. As a result, the same patch is produced in approximately forty minutes, a 91% reduction in patch time!

## III. BACKGROUND

This section provides background on automated program repair (APR), the APR tool used (TBar), program slicing, and ORBS, the observation-based slicer used in the experiments.

APR needs a specification of correct program behavior to determine if a generated patch fixes the target bug. In the absence of a complete or formal specification, existing APR tools use the test suite as an oracle for determining the desired behavior. Thus, testing is the primary method used to ensure the correctness of a generated patch, causing the cost of patch validation to depend heavily on the size of the test suite. As a program evolves its test suite tends to grow in size, which increases the time and resources required.

APR commonly involves three-phases: (1) fault localization produces a ranked list of suspicious locations; (2) patch generation involves a range of program mutations; and (3) patch validation checks whether the mutated program passes the test suite of the program. In greater detail, APR's first phase employs automated fault localization to produce a ranked list of suspicious statements based on the bug being repaired. The significant expense in this first phase is the quality of the fault location. Because APR tools attempt to fix a bug by repeatedly applying a set of potential patches to each potentially buggy location in the ranked list, the sooner the actual location of the bug is considered, the better.

The second phase, patch generation, explores the latent patch space that is typically defined by the set of program mutation operators employed and the list of suspicious statements. This phase requires the most innovation from an APR tool. Typically, this phase makes use of the code itself to derive potential patches. This means that the more cohesive the code, the more likely a patch will be found in the code itself. As an example, consider an application that maintains inventory, orders, and taxes. Code taken from a reduced program that just computes the taxes is more likely to be relevant to fixing a tax-related bug.

The final step, patch validation, ensures the correct behavior of the repaired program. As mentioned previously, the test suite is typically used to ensure that the bug is fixed and that the patch does not introduce any unwanted behavior. In practice, most tests are irrelevant to the bug being repaired and thus a huge saving can be obtained by avoiding their repetitive execution. At the bare minimum, the test suite must include at least one failing test that exposes the bug. Passing this test implies the bug has been fixed. The existence of additional passing tests can constrain the repair when used as regression tests. 2 However, such tests provide diminishing returns, and as their number grows performance decreases without any improvement in patch quality. Our test-suite reduction process aims to omit tests that have no impact on patch quality and thus only affect efficiency.

Template-based APR, which utilizes predefined fix templates to fix specific bugs, is widely used in the APR literature, and known to be effective at generating correct patches [6, 10-20]. The TBar tool [6] used in this work combines fifteen commonly used fix templates from the APR literature, making it one of the most effective APR tools available and achieving a good repair rate on Defects4J. However, like most APR tools, TBar is highly sensitive to fault localization accuracy and to the size of the test suite [3].

The following description of Observation-Based Slicing (ORBS) is taken from existing work [21-23]. Readers familiar with ORBS need only skim this section as a reminder. The key requirement for constructing the reduced program is a sound program reduction technique. This enables the repair process to be conducted using the reduced program while being able to conclude that the repair is valid for the original program. The program reduction technique we study in this paper is a form of dynamic program slicing [24]. Informally, a slice is a subset of a program that preserves the behavior of the program for a specific slicing criterion [25]. While static slices [25] preserve this behavior for all possible inputs , dynamic slicing [24] does so only for a selected set of inputs.

The slicing technique used to produce the reduced program studied in our experiments is observation-based slicing (ORBS), which works by deleting statements and then observing the behavior at the slicing criterion. ORBS takes as input a program P , a slicing criterion identified by a program variable ν , a program location l , and a set of inputs I . The resulting slice preserves the values of ν at l for the inputs of I .

Operationally, ORBS observes behavior by instrumenting the program with a side-effect free line that tracks the value of variable ν immediately before line l . Then, starting with P , ORBS repeatedly forms candidate slices by deleting a sequence of one to δ lines from the current slice. The candidate is rejected if it fails to compile or produces different values for ν . Otherwise, the candidate becomes the current slice. ORBS systematically forms candidates until no more lines can be deleted.

2 Observe that passing tests are also needed to pinpoint suspicious statements in the initial fault localization step.

While there are more time-efficient dynamic slicers, ORBS is sound and very accurate. Its slices are nearly minimal [21]. Thus, our use of ORBS can be seen as paralleling APR studies that assume perfect fault localization [6, 26-30]. Faster dynamic slicers, such as JavaSlicer [31] and Slicer4J [32], and dynamic/static hybrid slicers such as QSES [33] compute less accurate slices, but can drop slicing time from days to a matter of minutes.

## IV. EXPERIMENTAL DESIGN

This section lays out the experimental design. It first introduces the bugs we consider and then the metrics we used in the analysis. We then describe the steps of the algorithm that we study and the execution environment used. Finally, we present the research questions used to evaluate our approach.

## A. Subject Bugs Studied

Defects4j is a collection of reproducible bugs widely used in software engineering research [7]. Our experiments employ Defects4J v2.0.1 [7], which has been used in prior APR experiments [6, 13]. We consider two of the Defects4j systems, Lang and Math , because each includes a large number of bugs. Lang provides a collection of utility methods that work with java.lang including basic numerical methods, concurrency support, as well as utility methods to help construct methods such as hashCode , equals , etc. Math provides common mathematical and statistical methods. The authors work to limit 'external' dependencies, which, among other things, makes it easier for us to experiment with their code.

Table I shows demographics for the 47 subject bugs studied. Each bug includes a Bug ID , BID, its size in non-comment, non-blank lines of code, SLoC , and the number of passing and failing tests. Program size is given for both the original production code (i.e., excluding the test code) and the slice along with the slice's size as a percent of the original code. Finally, in addition to the number of passing tests, the number that apply to the slice is also included.

The initial collection of subjects included the 40 bugs from Defects4J's Lang and Math projects that TBar is able to patch [6] when given an idealized suspicious locations list that consists of only the location of the human-written patch . To this set, we add a few additional bugs that TBar was able to patch in our environment. From this set, our modified process fails to patch the eight bugs at the bottom of the table. For two, the fault locater exhausts its five-hour time allotment. For the other six, the slicer is essentially too aggressive and removes code needed by TBar to recompile the file containing the failing test. This code is unrelated to the failing test. Because it does not recompile the tests, the removal does not inhibit the slicer. We solved this problem by hand for Lang-33, where the failing test had the Assertion Roulette smell [34], by refactoring the single failing test into four smell-free tests. In future work, we hope to automate a fix for the other six similar bugs.

TABLE I

|           |        | SLoC        | SLoC                                                      | Slice                                                     | Passing                                                   | Tests                                                     | Failing                                                   |
|-----------|--------|-------------|-----------------------------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------|
|           | BID    | Orig        | Slice                                                     | as %                                                      | Orig                                                      | Slice                                                     | Tests                                                     |
| Lang Lang | 10 22* | 20442 18870 | 836 571                                                   | 4.1 3.0                                                   | 2196 1823                                                 | 73 35                                                     | 2 2                                                       |
| Lang      | 33     | 17302       | 907                                                       | 5.2                                                       | 1669                                                      | 67                                                        | 1                                                         |
| Lang      | 39     | 16983       | 1437                                                      | 8.5                                                       | 1617                                                      | 93                                                        | 1                                                         |
| Lang      | 43     | 18817       | 409                                                       | 2.2                                                       | 1807                                                      | 30                                                        | 1                                                         |
| Lang      | 44     | 18814       | 661                                                       | 3.5                                                       | 1784                                                      | 46                                                        | 1                                                         |
| Lang      | 45     | 18777       | 549                                                       | 2.9                                                       | 1782                                                      | 38                                                        | 1                                                         |
| Lang      | 47     | 18490       | 998                                                       | 5.4                                                       | 1733                                                      | 98                                                        | 2                                                         |
| Lang      | 51     | 17028       | 601                                                       | 3.5                                                       | 1630                                                      | 70                                                        | 1                                                         |
| Lang      |        | 16961       | 1098                                                      |                                                           |                                                           | 81                                                        | 1                                                         |
|           | 58     |             |                                                           | 6.5                                                       | 1594                                                      |                                                           | 1                                                         |
| Lang Lang | 59 63  | 16943 16791 | 571 1146                                                  | 3.4 6.8                                                   | 1592 1576                                                 | 52 36                                                     | 1                                                         |
| Lang      | 7      | 21495       | 836                                                       | 3.9                                                       | 2260                                                      | 93                                                        | 1                                                         |
| Math      |        |             |                                                           |                                                           |                                                           |                                                           |                                                           |
| Math      | 3* 4   | 83115 82856 | 6048 5971                                                 | 7.3 7.2                                                   | 4281 4235                                                 | 81 62                                                     | 1 2                                                       |
| Math      | 5      | 81560       | 10386                                                     | 12.7                                                      | 4180                                                      | 155                                                       | 1                                                         |
| Math      | 6      | 81309       | 14883                                                     | 18.3                                                      | 4146                                                      | 146                                                       | 28                                                        |
| Math      | 22     | 68184       | 10616                                                     | 15.6                                                      | 3401                                                      | 87                                                        | 2                                                         |
| Math      | 28     | 65079       | 3559                                                      | 5.5                                                       | 3265                                                      | 44                                                        | 1                                                         |
| Math      | 32     | 63767       | 5403                                                      | 8.5                                                       | 2881                                                      | 53                                                        | 1                                                         |
| Math      | 33     | 63136       | 3384                                                      | 5.4                                                       | 2863                                                      | 41                                                        | 1                                                         |
| Math      | 35     | 63064       | 2632                                                      | 4.2                                                       | 2838                                                      | 16                                                        | 4                                                         |
| Math      |        |             |                                                           |                                                           |                                                           |                                                           | 1                                                         |
|           | 50     | 54718       | 3335                                                      | 6.1                                                       | 2486                                                      | 29                                                        |                                                           |
| Math      | 58*    | 45271       | 3367                                                      | 7.4                                                       | 2185                                                      | 28                                                        | 1                                                         |
|           | 60*    |             |                                                           |                                                           |                                                           |                                                           |                                                           |
| Math      |        | 44036       | 3234                                                      | 7.3                                                       | 2069                                                      | 44                                                        | 1                                                         |
| Math      | 62     | 47371       | 3902                                                      | 8.2 9.5                                                   | 2216                                                      | 19                                                        | 1 1                                                       |
| Math Math | 63 65  | 44354 42470 | 4201 3573                                                 | 8.4                                                       | 2148 2139                                                 | 84 55                                                     | 1                                                         |
| Math      | 70     | 41186       | 3008                                                      | 7.3                                                       | 2088                                                      | 45                                                        | 1                                                         |
| Math      | 73*    | 39234       | 3113                                                      | 7.9                                                       | 2047                                                      | 40                                                        | 1                                                         |
| Math      | 75     | 39884       | 2936                                                      | 7.4                                                       | 2039                                                      | 39                                                        | 1                                                         |
|           |        |             |                                                           |                                                           | 2012                                                      |                                                           | 1                                                         |
| Math Math | 79 82  | 39306 38672 | 2312 2754                                                 | 5.9 7.1                                                   | 1966                                                      | 22 33                                                     | 1                                                         |
| Math      |        |             |                                                           |                                                           |                                                           |                                                           | 1                                                         |
|           | 85     | 38458       | 2760                                                      | 7.2                                                       | 1903                                                      | 40                                                        |                                                           |
| Math      | 89     | 30903       | 1002                                                      | 3.2                                                       | 1611                                                      | 8                                                         | 1                                                         |
| Math      | 95     | 19934       | 936                                                       | 4.7                                                       | 1223                                                      | 22                                                        | 1                                                         |
| Math      | 96     | 19511       | 653                                                       | 3.3                                                       | 1195                                                      | 97                                                        | 1                                                         |
| Math      | 98*    | 16725       | 1389                                                      | 8.3                                                       | 1017                                                      | 62                                                        | 2                                                         |
| Lang      | 57     |             | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              |
| Math      | 8      |             | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              |
| Math      | 30     |             | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              | Fault Localization times out                              |
| Math      | 34     |             | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              |
| Math      | 49     |             | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              |
| Math      | 59     |             | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              | Test Source fails to compile                              |
| Math      | 77     |             | Test Source fails to compile Test Source fails to compile | Test Source fails to compile Test Source fails to compile | Test Source fails to compile Test Source fails to compile | Test Source fails to compile Test Source fails to compile | Test Source fails to compile Test Source fails to compile |

THE SUBJECT BUGS STUDIED.

## B. Metrics

The experiments employ six metrics, Source Lines of Code, SLoC , Test-Suite Size, TSS , Bug Rank, BR , Repair Time, RT , Number of Patch Candidates, NPC [35], and Number of Test Executions, NTE . SLoC measures the non-comment, non-blank lines of code. In contrast to simple line counts, SLoC better indicates the amount of effort involved when working with source code. The removal of code through slicing obviates the need for some of the tests. We capture this reduction in the size of the test suite, TSS . Ideally, having less unrelated code to consider should focus fault localization and improve, BR , the rank of the buggy statement in the list of suspicious locations. We report repair time, RT , as the wallclock time used by TBar to patch a bug. All of the experiments were run on the same hardware making the wall-clock time

Fig. 1. The lattice of all possible configurations of program ( P or P S ), test suite ( T , or T S ), and suspicious locations list ( L L , S , or L P ).

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-03e79b3a-7595-4aa1-9397-051dcf257dbe.jpg)

proportional to the CPU time thus we do not report both. NPC counts the number of patch attempts before a valid patch is found and has become a common metric for evaluating APR tools [3, 36, 37]. In our work, it is used to quantify the efficiency gain brought about by using the more cohesive reduced program.

Finally, we augment the use of NPC by introducing a new metric NTE , the number of test executions performed before a patch is found. We introduce this metric because a reduction in the size of the test suite is expected to improve RT but not NPC , so NPC cannot be used to study this RT improvement. The use of NTE parallels the use of NPC to study the RT improvement that comes from the improved ranking of the faulty statement. Our goal is that NTE and NPC together will accurately characterize the reduction in RT .

## C. Repair Process

Our repair process is applied to buggy program P and its test suite T , and consists of the four steps discussed below.

- 1) For the program reduction step we use program slicing to produce P S from P by eliminating code irrelevant to the bug being repaired.
- 2) The test-suite reduction step reduces the test suite T by removing tests for code not found in P S . The result is a reduced test suite T S that preserves T 's test coverage relative to the bug being repaired.
- 3) The reduced suspicious list is determined in one of two ways. The first method regenerates the list by applying fault localization to P S and T S producing L S , while the second method prunes from the original list all locations that are not present in the slice, producing L P .

The goal of the first approach is to focus fault localization on the relevant portions of the code (i.e., those found in the slice). The advantage of the second approach is that the rank of the buggy statement is guaranteed to be no worse.

- 4) The program repair step applies TBar to various combinations of P , T , L P , S , T S , L P , and L S , that conform the lattice shown in Figure 1, which is discussed below.

To isolate the impact of the various reductions on TBar's performance, we consider the lattice of possible configurations shown in Figure 1. With two programs ( P or P S ), two test suites ( T , or T S ), and three suspicious locations lists ( L L , S , or L P ) there are twelve possible configurations. However, those shown in red are not viable because T and L include program locations not found in the P S . In the lattice, each subscript indicates, in order, the program, the test suite, and the ranked list of suspicious locations used. Thus, C PT L is the original configuration while C P T L S S P uses P S , T S , and L P .

## D. Tools

Our experiments use the following tools: first, as previously mentioned, we use the APR tool TBar, available as part of the replication package for the paper introducing TBar [6], as a representative state-of-the-art template-based APR tool. The only modification required is to register the use of the sliced code or reduced test suite with the version control system via git add -u before applying TBar.

For Step 1, the reduction step, we use parallel ORBS version 5.0 [22]. The test-suite reduction uses tree-sitter to build the AST for each test file and then repeatedly removes test methods that fail when applied to P S or to P . Step 3 uses the spectrum-based fault locater GZoltar V.1.7.3 [38] with the Ochiai ranking strategy, which has empirically been shown to be one of the most effective metrics for fault localization [39]. Finally, the experiments were run in a Docker container on a cluster of AMD EPYC 7763's. Each run allotted TBar four processors and a time limit of 24 hours.

## E. Research Questions

Using these tools we consider the following Research Questions. We expect the overall improvement to come from two primary causes: improved fault localization rank of the buggy statement and the reduced test suite. RQ1 considers the impact of the reduction on the size of the buggy program. RQ2 and RQ3 break out the two causes of improvement and attempt to quantify the two reductions, while RQ4 and RQ5 consider their impact on TBar. RQ6 considers the impact of our reduction techniques on TBar's repair time.

- RQ1: How effective is slicing at reducing the size of the buggy program?

Slicing has never been applied to preserving JUnit error messages and thus might prove ineffective at the task. For this RQ we compare the SLoC found in P and P S .

RQ2: Howeffective is the reduced program when used for testsuite reduction?

This RQ isolates the impact of using the reduced program to cull the test suite, which we measure using TSS .

RQ3: How does program reduction impact fault localization? This RQ isolates the impact of using the reduced program to improve the rank of the buggy statement, which is measured using BR in both L S and L P .

RQ4: How does using a reduced test suite affect TBar?

RQ4 builds on RQ2 to investigate the test-suite reduction's impact on TBar's testing effort, as measured using NTE .

- RQ5: What is the impact of using the updated list of suspicious statements on TBar?

RQ5 builds on RQ3 to investigate the improvement better bug rank (lower BR ) has on TBar's performance as measured using NPC .

RQ6: What is the overall improvement obtained using TBar with the reduced program?

Finally, we use RT to study the end-to-end performance improvement that the reduced program has on TBar at various points in the lattice shown in Figure 1.

## V. RESULTS AND DISCUSSION

This section considers each of our research questions in turn and concludes with a discussion of the implications of the patterns seen in the data.

## A. RQ1

RQ1 considers the size reduction achieved using program slicing. Figure 2 shows the size of the production code, which excludes test code and alike, compared to the size of the reduced production code. As noted previously, slicing has never been applied to preserving JUnit error messages. While there are interesting issues such as Math-5's reciprocal test issue discussed with RQ3, overall the approach is quite effective. Compared to the average dynamic slice size of approximately 60% of the code [40], for the programs shown in Table I the slices range from 2.2% to 18.3% of the original code with an average size of only 6.6%. Some of this is likely related to the nature of the particular subjects, but using JUnit tests as a slicing criterion may prove worthy of future study. It would be interesting to do a more apples-to-apples comparison using subjects studied in prior dynamic slicing research.

In answer to RQ1, slicing is quite effective at reducing the size of the program necessary to reproduce the bug. Furthermore, this reduction is fairly uniform.

## B. RQ2

RQ2 considers the test-suite size reduction obtained by removing tests that apply to parts of the code not in the slice. Here again, as seen in Figure 3 as well as Table I, using the reduced program leads to a dramatic reduction in TSS . The original test suite includes an average 2249 tests per project, which is

Fig. 2. Reduction's impact on each program's SLoC .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-c1f9989c-776a-4c64-bdb7-951363932a74.jpg)

reduced to an average of only 56! The greatest reduction, for Math-89 , leaves only eight passing and one failing test. The magnitude of the reduction is, de-facto related to the size of the original test suite. It would be interesting to study the reduction after applying traditional test-suite minimization [41].

One interesting question the dramatic reduction raises is, is the reduction too extreme. That is does it not leave sufficient tests for the downstream tools to work effectively? In theory TBar needs only a single failing test case. Of course, in the absence of good regression tests, overfitting is a potential problem. At the same time many of the tests in the original test suite have zero impact on the repair process and thus their repeated execution is a significant waste of time.

In answer to RQ2, slicing is quite effective reducing testsuite size.

## C. RQ3

Starting with RQ3 we remove from the dataset those projects that TBar fails to patch. The initial set of projects we started with includes all projects that TBar can patch given an ideal suspicious statements list of length one [6]. In less ideal situations (e.g., using GZoltar's list of suspicious statements in lieu of the ideal list) there are cases where TBar is unable to find a patch. These bugs are marked with a '*' in Table I.

RQ3 investigates BR , the rank in the list of suspicious statements of the statement to which TBar applies a successful patch. It is important to note that we are not reporting the location of a predetermined static statement but rather the statement dynamically chosen by TBar.

The predetermined static statement approach is clearly more straightforward: ahead of time, one selects a statement to be the correct patch location and then determines its rank on each suspicious statements list. In cases where there is only one correct patch location, this approach has some appeal. It also simplifies correctness arguments when, for example, the predetermined location is taken from a subsequently patched

Fig. 3. Reduction's impact on each program's TSS .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-847ba7d5-f4c1-4045-b1e2-fb25f1645feb.jpg)

version of the code. However, this approach denies the possibility of alternate fixes at alternate fix locations and thus is rather limiting.

The dynamic approach is more flexible as it gives TBar credit for finding patches at alternative locations. Of course, alternative locations complicate the correctness argument. Because of this, we consider two sets of bugs. The first, all the data includes those bugs for which TBar finds a patch in the base C PT L configuration. These are listed in Table I without a '*'. We use these bugs to establish overall trends. The second set considers only those projects where the patch location is the same as that found using C PT L . As with the straightforward approach, this enables us to make direct correctness arguments. One interesting question here is whether this subset shows the same general trends.

For both all the data and the subset using the same patch location, our analysis considers two different reduced suspicious statements lists, L P and L S . By removing statements from L that are not in the slice, L P has the advantage that it is never larger than L . Assuming that location patch-ability does not change, using L P should enable TBar to choose a statement of lower or equal rank. As discussed below, this assumption is violated in one case.

The second list, L S , hopes that GZoltar does better when applied to the more focused P S and T S . It mostly does. In the data, there are only two cases, Math-5 and Math-75, where the list of suspicious statements produced by GZoltar is larger for L S than for L . We leave it to future work to better understand if these longer lists provide evidence of GZoltar finding a greater number of viable locations or if the longer lists simply include more false positives.

Turning to the BR data, we first consider all of the data. Showing the baseline L in the middle, the upper chart of Figure 4 compares BR separately for Lang and Math. TBar is unable to patch one bug, Math-6, under C PT L P and three, Math-6, Math-35, and Math-64 under C PT L S . Thus from an applicability perspective C PT L P is preferred.

The expected pattern, where the reduced list produces lower BR s, is mostly evident in the figure. For example, the max and median BR s using L P (shown to the right of L , in green) are lower than in L (the median is shown as the central dashed line). (Numerically, these are 69.0 and 7.0 verses 82.0 and 9.5.) For L S , Lang shows this same pattern, but Math does not, largely because of one bug discussed below.

Considering the individual bugs, both Lang and Math include a handful of bugs for which BR in L S is larger than BR in L . Most of the time the difference is small, but not always. For example, Math-82's BR is 89 in L S while only 49 in L . This one project accounts for the long thin spire of the L S Math violin plot and dominates the reason that Math does not follow the expected pattern.

For L P , pruning L can never make the list longer. It is therefore easy to likewise conclude that the BR of the patched statement can never be greater using L P . However, checking the data, we find one exception, Math-5 where the BR in L is one while the BR in L P is two. For this to happen, the rank-

Fig. 4. Reduction's impact on each program's L .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-23fee693-496b-43a5-92b7-7fb1ae3cc22d.jpg)

one statement from L cannot be in the slice and thus gets removed during pruning. That another viable patch location was found is interesting. Fortuitously, it was not at rank one, otherwise this anomaly might have gone unnoticed. The details are explored in the discussion at the end of this section.

The lower chart in Figure 4 shows only those bugs where TBar patches the same location using the three lists. For Lang all the bugs use the same location, thus the charts are identical. For Math fifteen of the bugs use the same location, while six are patched at different locations. The dominance of same-location patches means that most patches inherit patch correctness from the correctness of the C PT L patch. However, a different patch location does not mean the patch is incorrect, it simply means that it is harder to argue its correctness. Finally, as expected for this subset, L P always results in a patch location with an equal or lower BR .

To answer RQ3, while for the most part the rank of the statement that TBar patches is lower in C PT L P and C PT L S than in C PT L , this is not ubiquitous, nor is the reduction as dramatic as that seen for SLoC and TSS . It is encouraging that most patches are at the same location, which implies

that the reduction in rank does not negatively impact the patch. Finally, overall C PT L P performs better than C PT L S .

## D. RQ4

RQ4 investigates the effort TBar expends testing potential patches, measured using the number of test executions, NTE . Similar to our analysis of RQ3 we first consider all the data and then the subset where C PT L and C PT L S choose the same patch location. Figure 5 compares the testing effort using all of the data. Note that the y -axis uses a logarithmic scale.

The reduction is dramatic. For Lang, NTE drops from an average of 687,946 to an average of only 48,492, a 93% reduction. For Math, NTE drops from 227,604 to 6,649, a 97% reduction. Clearly, the reduction in TSS seen in RQ2 leads to a dramatic reduction in NTE .

Even better, unlike in RQ3, where using the reduced suspicious statements lists, caused TBar to fail to patch three of the bugs, when using the reduced test suite, TBar is able to patch all of the bugs. On top of this, it does so at the same location; thus Figure 5 is also the figure when using the same-location subset.

To answer RQ4, slicing is successful at reducing TBar's testing effort, NTE , without reducing its applicability.

## E. RQ5

RQ5 mirrors RQ4 replacing NTE with NPC , the number of patch candidates. The impact on NPC of using the updated list of suspicious statements is shown in Figure 6 where it is visually obvious that the improvement is less dramatic than for NTE . Comparing the center violin plot with its right and left neighbors, using L P always brings a benefit. The same is not true for L S where the inferior ranks for L S seen in RQ3 are again evident for Math.

For the pruned list L P , average NPC drops from 573 to 502 for Lang, a 12% reduction, and from 220 to 189 for Math, a 14% reduction. Using L S the results are mixed. For Lang NPC drops from 573 to 523, a 9% reduction, but for Math it rises from 220 to 389, a 77% increase . The inferior and

Fig. 5. Reduction in test-suite size's impact on each project's NTE .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-3fa61c81-9c29-4257-bd4b-51405f7e631e.jpg)

varied performance attained using L S stands in contrast to the expectation that performing fault localization on the reduced program would focus the fault locator and thus improve its performance. The data suggests that this is not the case. It would be interesting to investigate the interplay between the amount of code reduction and the performance of fault localization.

Turning to the subset where the same patch location is used, because all of the Lang patches are at the same location, the results for the same-location subset are identical. For Math the performance is mixed. Using L P NPC drops from 246 to 227, which is only an 8% reduction compared to the 14% for all the data. On the other hand, while still negative, for L S the increase from 246 to 352 is only a 43% increase, down from the 77% when using all the data.

In answer to RQ5, as expected the data mirror the L -data from RQ3. Compared with the NTE results for RQ4, slicing is notably less effective at reducing NPC .

## F. RQ6

RQ6 investigates the impact of combining the reductions of NTE and NPC on TBar's repair time, RT . The greatest

Fig. 6. Reduction's impact on each program repair's NPC .

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-766a628b-604c-4e1d-814d-d15cc0406b38.jpg)

| Configuration   | All   | Lang   | Math   | Failures   |
|-----------------|-------|--------|--------|------------|
| Three changes   |       |        |        |            |
| C P S T S L P   | 82%   | 91%    | 74%    | 11         |
| C P S T S L S   | 78%   | 88%    | 67%    | 12         |
| Two changes     |       |        |        |            |
| C PT S L P      | 88%   | 89%    | 87%    | 2          |
| C PT S L S      | 83%   | 89%    | 76%    | 3          |
| One change      |       |        |        |            |
| C PT S L        | 86%   | 86%    | 85%    | 0          |
| C PTL P         | 14%   | 15%    | 12%    | 2          |
| C PTL S         | -75%  | 7%     | -174%  | 3          |

## TABLE II

REPAIR TIME REDUCTION RELATIVE TO C PTL . THE FINAL COLUMN REPORTS THE NUMBER OF BUGS WHERE TBAR SUCCEEDS USING C PTL BUT NOT THE LISTED CONFIGURATION.

reduction is expected with either C P T L S S P or C P T L S S S , which make use of the reduced program, the reduced test suite, and one of the reduced suspicious statements lists. Overall, these configuration yield almost an order of magnitude reduction, as can be seen in the top two rows of Table II, which breaks the repair time reduction down by project and also reports the number of bugs that TBar fails to patch despite C PT L succeeding. Breaking this down by project, for Lang using L P the mean repair time drops from 10946s to 990s, a 91% reduction, while for L S it drops to 1290, an 88% reduction. The reduction for Math is less dramatic. For Lang the L P reduction, from 8324s to 2251s, is 74%, while for L S the reduction to 2701s, is 67%, which is still notable. The drawback in these impressive reductions is the number of TBar failures. Using P S , TBar is unable to patch roughly a third of the bugs that it can patch using P . That TBar struggles to patch the smaller sliced program comes as a bit of a surprise and warrants future investigation.

To better understand the reduction and the failures, we consider the intermediate points of the configuration lattice shown in Figure 1. Starting with the second level of Figure 1, as shown in the last three lines of Table II, test-suite reduction clearly brings the larger benefit. In contrast the individual reduced suspicious statements lists bring mixed benefit. In the worst case, using L S actually hurts the performance of the Math bugs. The negative performance is dominated by Math5 whose repair time goes from 492s to 31671s. In contrast, the L S lists improve Lang's repair time by a modest 6%.

With Lang, L P fairs better, seeing a respectable 14% reduction. However, the 'reduction' for Math is again negative. It is notable that L P leads to an average reduction of 12.6% when Math-5 is excluded. We return to Math-5 in the discussion section, since this anomaly warrants deeper investigation.

The center of Table II considers the level in the lattice where two of the three possible reductions are applied. Here the test-case reduction's impact again clearly dominates. It is interesting that compared to C PT L S , C PT L S P provides a strict improvement for Lang and Math. This gives us optimism that

Fig. 7. Reduction's impact on overall repair time, RT , for C P T S S L S and C P T S S L P restricted to the bugs where TBar chooses the same patch location.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-ed7c0f8b-84a6-4bc2-bdf9-203920c7e6ab.jpg)

Fig. 8. Reduction's impact on overall repair time, RT , for C PT S L S and C PT S L P restricted to the bugs where TBar chooses the same patch location.

![image](https://ac.marcodsn.me/arxiv-markdown-images/2408.01134v1-figure-c6683019-1647-473b-a362-090146377530.jpg)

with additional effort we can devise suspicious statements list reduction techniques that are effective across all projects.

Comparing the two middle and the top two rows, using P S benefits only one case, with Lang using C P T L S S P , which is a bit discouraging. Much of the difference is caused by bugs where TBar uses different patch locations. To dig deeper, Figures 7 and 8 compare the performance on the subset where TBar uses the same patch location. Figure 7 compares C P T L S S S and C P T L S S P , while Figure 8 compares C PT L S S and C PT L S P . The two figures show very much the same reduction pattern, except that Figure 8 summarizes 50% more data, which underscores the challenge TBar faces trying to patch P S .

Finally, it is interesting that despite P S and T S showing similar large reductions, the T S reduction has a dramatic impact on RT while the P S reduction does not. The obvious challenge here is to find a way for P S to have a similar impact.

In answer to RQ6 the results are somewhat mixed. Clearly the T S reduction brings RT benefit. However, the P S reduction does not. The overall impact is still impressive, but would be even more impressive if future APR tools could better leverage the P S reduction.

## G. Discussion

This section reflects on some of the questions raised in the experiments. To begin with, the bottom of Table I includes eight bugs that failed before getting to the TBar stage of our tool pipeline. For two of these GZoltar times out. So, despite the fact the TBar can patch these two given the location of the bug, finding that location proves a challenge. One interesting question here is why GZoltar was not able to leverage the more focused P S and T S .

For the other six bugs, the slicer is essentially too aggressive and removes code needed by Defects4J to compile the test suite. (TBar works through the Defect4J interface.) For efficiency the slicer does not recompile the Java test files. This means that if there is test code in the same file as the failing test, the slicer may remove production code needed to compile that test even though it is never executed. An ad-hoc preliminary experiment that modified ORBS to verify that the test file compiled solved this problem in one case. We plan to work on better engineering solutions that more generally address this issue.

Second, compared with the NTE results for RQ4, slicing is notably less effective at reducing NPC and RT . In theory the search for locations in P S should be more efficient, so here again slice-aware fault location might be interesting to explore. Since most of the slices include the patch location, it seems reasonable to devise fault locators that can leverage being applied to the slice. Another consideration is that Lang and Math are both utility collections. It is possible that for a more monolithic program, P S would have greater impact. In terms of RT , one experiment worth running is to consider a project that involves computationally complex aspects. If such code is not in the slice then P S should lead to RT improvements akin to those T S provides.

While the test-suite reduction is impressive it is possible that insufficient tests remain. Math-6 had by far the most failing test cases (and the second highest number of passing tests in T S ), so it is worthwhile to consider if it was particularly easy or challenging to patch. For starters, the rank of the patch location in L is one. An optimistic reading of this is that all the failing tests helped locate the fault. Unfortunately plenty of other patches involve the Rank 1 location. Math-6 is one of two bugs that C PT L S is unable to patch, which suggests that insufficient tests is not limiting GZoltar. Comparing our other metrics, none stand out. Perhaps the silver lining here is that patch success does not depend on having a large number of failing or passing tests.

Finally, we consider two cases studies, Lang-33, which exhibits the Assertion Roulette test smell [34], and Math5, which was successfully patched at an alternate location.

```

learly = {
```

Fig. 9. Example from Lang-33.

To begin with, Figure 9 shows a code excerpt in which the test method testToClass\_object includes multiple asserts and thus exhibits the Assertion Roulette test smell [34]. Two of the test's four asserts are shown (on Lines 2 and 4). Following the test method, Lines 8-19 show the method under test. This code generates a null dereference exception on Line 16 when i=1 because array[i] is null for the test on Line 5.

The slicer unwantedly removes Lines 9-13 from the method toCLass without affecting the program behavior because it still generates a null dereference exception . However, the exception is now coming from the use of array.length on Line 14 and is now generated by the assert on Line 2. Lines 9-13 get removed because their absence does not change the program behavior. Refactoring the test method into four test methods, and thus removing the Assertion Roulette test smell, fixes the issue because the initial deletion of Lines 9-13 now causes the first test to fail in addition to the fourth. This example highlights one of the challenges caused by using bug error messages as a slicing criterion. The results for Lang-33 reported in this paper make use of the refactored test.

The second case study looks at the Math-5 anomaly. Although pruning L to produce L P should not result in the use of a lower-ranked location as it cannot make the list longer, our investigation of RQ3 found that this happened for Math-5, as the Rank 1 location was pruned away from L . The cause is complex but illustrative. Figure 10 shows excepts from the relevant code. To begin the assertion method used (Line 1 of Figure 10) takes as its first argument the expected value. The call, shown on Line 14, inverts expected and actual . It should use Complex.INF as the first argument. While this does not impact the slicer nor TBar, which both only look for differences in the output, it does impact human understanding. Specifically, the test output shown on Lines 5 and 6 is backwards. The correct output is shown on Lines 9 and 10. Again the slicer and TBar only monitor change, so the slice and the patch are correct but the order is relevant to understanding the interplay between L S and L . Using C PT L , the original TBar patch replaces Line 19 with Line 23. This patch correctly returns the reciprocal of 0 as the library's constant INF .

```
// assertion method used: assertEquals(expected, actual)    that anol
//                                                                                                                                                                                                        
//  Original error output                                                                                                                                                                                                        //
//  Test failed!
```

Fig. 10. Example from Math-5.

Using C PT L P , the slice omits the original patch location (Lines 18-20), which means the location is pruned from L when producing L P and thus is not available to TBar. The slicer can remove Lines 18-20 because subsequent code (shown on Lines 27-30) results in a division by zero when real is 0 , which the Java runtime maps to the value infinity. The value returned by createComplex on Line 30 is Complex(Infinity, Infinity). It is important to note that this value is not the same value as the constant returned on Line 23, whose declaration is shown on Line 34. However, the two print the same; thus, the deletion leaves the error message unchanged. Detecting no change in the output, ORBS concludes that the relevant program behavior has not changed. While it may not appear serious, this is an informative limitation of using value-based slicers such as ORBS. Interestingly, if the program had printed INF differently from Java's default printing of infinity, the deletion would not have occurred.

Unfortunately, the patch TBar produced under C PT L P is inferior, or this would have made a great example of the value of considering alternate patch locations. The patch, shown on Line 43, modifies the equals method so that all complex numbers equal NaN, which is clearly undesired. Still, the fact that another viable patch location was found is interesting and suggests that APR's use of a 'perfect patch' may be undesirable.

ORBS is expensive. It is possible that other, unsound, lighter-weight reduction techniques might be sufficient, but to understand the tradeoffs, we first need to understand how effective ORBS is when applied to the buggy code.

Finally, our experiments make use of one-minimal ORBS slices. Because these are minimal and, by construction, capture the execution of the slicing criterion, their use allows us to focus on slicing's impact. This is akin to the experiments with TBar that use an optimal list of suspicious statements [6]. In practice, ORBS is too slow to be used in production (while some engineering work would reduce its runtime, the median slice time for Lang was just over seven hours and that for Math was just under 34 hours). Fortunately, there exist faster slicers. For example, the slicer studied by Wang et al. [31] when slicing JFreeChart (an application similar is size to Lang) slices at about 400 SLoC per second (including SDG construction time). Thus, we expect it to slice the largest of the systems we consider in under five minutes.

## VI. RELATED WORK

We distinguish several areas of related work, ranging from techniques to improve APR and fault localization, to related applications of program reduction.

Improving APR: Early research in APR focused on developing new patch-generation algorithms such as heuristicbased [5, 42], constraint-based [43, 44], and learningbased [45, 46], all aimed at improving the efficacy of APR by producing more correct patches and addressing the wellknown patch overfitting problem [47, 48].

More recently, researchers have started focusing on techniques to improve the efficiency of APR. Several techniques have been developed, including regression test selection [49, 50], patch filtering [51, 52], and on-the-fly patch generation [12] and validation [45, 53]. The goal of these techniques is to reduce the cost of patch compilation and test case execution, which are the dominant factors in APR efficiency. While each of these techniques has the potential to reduce program repair costs, they typically only affect a particular phase of the APR process. The combination of slicing with APR has the potential to improve all phases of APR, including fault localization, patch generation, and patch validation.

While this paper studies the impact of program reduction on a template-based APR, the impact on recent neural APR approaches that build on large language models (LLMs) could even be larger. For example, recent work that combines various LLM-based APR approaches reported generating plausible patches for the bugs in Defects4J in 2.5 hours using 'perfect fault localization' , i.e., using known bug locations and omitting the fault localization step [30]. Another study that does not assume perfect fault localization reported that most plausible patches are produced in 1 to 10 hours, and half of them are generated in 4.5 hours [54]. Reducing the size of the program to consider should greatly reduce these times, and

the corresponding test-suite reduction will further reduce the time needed for patch validation.

Fault localization in APR: Fault localization is one of the key phases of the APR process because it affects not only the performance but also the correctness of generated patches [4, 55-57]. Unfortunately, fault localization still suffers from accuracy issues [3, 4]. Moreover, some classes of APR tools are more sensitive to its accuracy than others and a recent study by Liu et al. showed that template-based APR is highly sensitive to fault localization noise [3].

Several papers aim to improve fault localization by reducing the program spectra (i.e., the code coverage data) that need to be analyzed. The reduction approaches range from delta debugging [58], program slicing [59-63], test generation [64], to test prioritization [65]. In particular, Zhang et al. [59] evaluate the effectiveness of three variants of dynamic slicing algorithms. Li and Orso [61] proposed the concept of potential memory-address dependence to improve the accuracy of dynamic slicing. Recently, Soha [63] conducted a thorough analysis of combining various slicing and spectrum-based fault localization algorithms. In contrast to our work, these papers do not empirically examine the effects of test-suite and code reduction, nor how the fault localization improvement obtained through slicing affects the efficiency of APR. Closer to our work, Guo et al. [66] analyze how Java slices impact the constraint-based APR tool Nopol [67] through its impact on the spectrum-based fault localization used by Nopol. They show how dynamic slicing impact on fault localization lowers NPC and RT .

Other applications of program reduction: Program slicing was originally developed as a debugging technique to help developers focus by reducing a program to exactly those statements relevant for the behavior at a point of interest [25, 68]. Since those early days, the abstraction capabilities of slicing have been used for various software engineering challenges, ranging from software testing, software maintenance and evolution, to finding elements for reuse [69, 70].

- A related idea applies dynamic Slicing to improve (spectrum-based) fault Localization [71]. The key intuition in this work is that highly ranked statements not covered by failing executions are likely unrelated to the fault. The paper shows that dynamic slicing substantially improves the rank of faulty statements. Our fault location results mirror these thus improving the validity of both studies.

Of particular interest in the context of this paper is the application of program slicing to reduce the scope of what needs to be analyzed in program verification and model checking [72, 73], which has been shown to be an effective way to reduce verification time [74, 75].

## VII. CONCLUDING REMARKS AND FUTURE WORK

Automatic program repair of large-scale programs is a difficult and time-consuming task. It can take hours, and in many situations APR tools are unable to exhaustively search the patch space. Prior work showed that the most challenging parts of the repair process are finding faulty statements and verifying the generated patch's correctness. Instead of examining an entire program, this work aims to focus the repair process on a relatively small portion of the program in the form of a program slice.

The experiments show that slicing can significantly improve the performance of template-based APR, but not in all cases. The benefit is primarily through test-suite size reduction. Like most research problems, this investigation raises as many question as it answers. Future work will consider addressing the limitations we encountered, such as how to better exploit the reduced program in fault localization. We also intend to consider other classes of APR tools, mainly neural and semantic-based APR tools.

Finally, we hope to develop a better understanding of TBar's inability to patch P S and the poor performance of GZoltar when applies to P S and T S . One possibility here is that as libraries, Math and Lang might prove harder to fix because they include less cohesive code, which makes it more likely that the code violates the plastic surgery hypothesis [76]. Nonlibrary slices are expected to be larger and more cohesive making them more likely to include reusable code. Thus we plan experiments that considers projects with a range of cohesiveness to see if there is any correlation with TBar's and GZoltar's performance.

## ACKNOWLEDGEMENTS

The research presented in this paper was financially supported by the Research Council of Norway through the secureIT project (grant #288787).

The authors wish to thank Lulu Wang for providing JavaSlicer and assisting in getting it to run for our experiments.

## REFERENCES

- [1] M. Monperrus. 'Automatic Software Repair: A Bibliography.' In: ACM Computing Surveys 51.1 (2018), pp. 1-24. DOI: 10.1145/3105906.
- [2] C. Le Goues, M. Pradel, and A. Roychoudhury. 'Automated Program Repair.' In: Communications of the ACM 62.12 (2019), pp. 56-65. DOI: 10.1145/3318162.
- [3] K. Liu et al. 'On the Efficiency of Test Suite Based Program Repair: A Systematic Assessment of 16 Automated Repair Systems for Java Programs.' In: International Conference on Software Engineering (ICSE) . ACM, 2020, pp. 615-627. DOI: 10.1145/3377811.3380338.
- [4] K. Liu, A. Koyuncu, T. F. Bissyande, D. Kim, J. Klein, and Y. Le Traon. 'You Cannot Fix What You Cannot Find! An Investigation of Fault Localization Bias in Benchmarking Automated Program Repair Systems.' In: Conference on Software Testing, Validation and Verification (ICST) . IEEE, 2019, pp. 102-113. DOI: 10.1109/icst.2019. 00020.
- [5] C. Le Goues, T. Nguyen, S. Forrest, and W. Weimer. 'GenProg: A Generic Method for Automatic Software Repair.' In: IEEE Transactions on Software Engineering 38.1 (2012), pp. 54-72. DOI: 10.1109/ tse.2011.104.
- [6] K. Liu, A. Koyuncu, D. Kim, and T. F. Bissyand´ e. 'TBar: Revisiting Template-Based Automated Program Repair.' In: International Symposium on Software Testing and Analysis (ISSTA) . ACM, 2019, pp. 31-42. DOI: 10.1145/3293882.3330577.
- [7] R. Just, D. Jalali, and M. D. Ernst. 'Defects4J: A Database of Existing Faults to Enable Controlled Testing Studies for Java Programs.' In: International Symposium on Software Testing and Analysis (ISSTA) . ACM, 2014, pp. 437-440. DOI: 10.1145/2610384.2628055.
- [8] W. Weimer, Z. P. Fry, and S. Forrest. 'Leveraging Program Equivalence for Adaptive Program Repair: Models and First Results.' In: IEEE/ACM International Conference on Automated Software Engineering (ASE) . 2013, pp. 356-366. DOI: 10.1109/ASE.2013.6693094.

| [9]   | C. Le Goues, S. Forrest, and W. Weimer. 'Current Challenges in Automatic Software Repair.' In: Software Quality Journal 21.3 (2013),                                                                                                                                                                                        |
|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [10]  | pp. 421-443. DOI: 10.1007/s11219-013-9208-0. X. B. D. Le, D. Lo, and C. Le Goues. 'History Driven Program Repair.' In: IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER) . Vol. 1. 2016, pp. 213-224. DOI: 10.1109/SANER.2016.76.                                               |
| [11]  | T. Durieux, B. Cornu, L. Seinturier, and M. Monperrus. 'Dynamic Patch Generation for Null Pointer Exceptions Using Metaprogram- ming.' In: IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER) . 2017, pp. 349-358. DOI: 10. 1109/SANER.2017.7884635.                              |
| [12]  | J. Hua, M. Zhang, K. Wang, and S. Khurshid. 'Towards Practical Pro- gram Repair with On-Demand Candidate Generation.' In: International Conference on Software Engineering . ACM, 2018, pp. 12-23. DOI: 10.1145/3180155.3180245.                                                                                            |
| [13]  | J. Jiang, Y. Xiong, H. Zhang, Q. Gao, and X. Chen. 'Shaping Program Repair Space with Existing Patches and Similar Code.' In: ACM SIGSOFT International Symposium on Software Testing and Analysis .                                                                                                                        |
| [14]  | ACM, 2018, pp. 298-309. DOI: 10.1145/3213846.3213871. A. Koyuncu, K. Liu, T. F. Bissyand´, e D. Kim, J. Klein, M. Monperrus, and Y. Le Traon. 'FixMiner: Mining Relevant Fix Patterns for Auto- mated Program Repair.' In: Empirical Software Engineering (2020). DOI: 10.1007/s10664-019-09780-z. arXiv: 1810.01791 [cs] . |
| [15]  | K. Liu, A. Koyuncu, D. Kim, and T. F. Bissyand`. e 'AVATAR: Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations.' In: IEEE 26th International Conference on Software Analysis, Evolution and Reengineering (SANER) . 2019, pp. 1-12. DOI: 10.1109/saner.                                                   |
| [16]  | 2019.8667970. X. Liu and H. Zhong. 'Mining Stackoverflow for Program Repair.' In: International Conference on Software Analysis, Evolution and Reengineering (SANER) . IEEE, 2018, pp. 118-129. DOI: 10.1109/ saner.2018.8330202.                                                                                           |
| [17]  | F. Long, P. Amidon, and M. Rinard. 'Automatic Inference of Code Transforms for Patch Generation.' In: Joint European Software Engi- neering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE) . ACM, 2017, pp. 727-739. DOI: 10.1145/ 3106237.3106253.                                         |
| [18]  | R. K. Saha, Y. Lyu, H. Yoshida, and M. R. Prasad. 'Elixir: Effective Object-Oriented Program Repair.' In: IEEE/ACM International Con- ference on Automated Software Engineering (ASE) . 2017, pp. 648-659.                                                                                                                  |
| [19]  | DOI: 10.1109/ASE.2017.8115675. M. Wen, J. Chen, R. Wu, D. Hao, and S.-C. Cheung. 'Context-Aware Patch Generation for Better Automated Program Repair.' In: Interna- tional Conference on Software Engineering . ACM, 2018, pp. 1-11. DOI: 10.1145/3180155.3180233.                                                          |
| [20]  | Q. Xin and S. P. Reiss. 'Leveraging Syntax-Related Code for Auto- mated Program Repair.' In: IEEE/ACM International Conference on Automated Software Engineering (ASE) . 2017, pp. 660-670. DOI: 10. 1109/ASE.2017.8115676.                                                                                                 |
| [21]  | D. Binkley, N. Gold, M. Harman, S. Islam, J. Krinke, and S. Yoo. 'ORBS: Language-Independent Program Slicing.' In: International Symposium on Foundations of Software Engineering (FSE) . ACM,                                                                                                                              |
| [22]  | 2014, pp. 109-120. DOI: 10.1145/2635868.2635893. S. Islam and D. Binkley. 'PORBS: A Parallel Observation-Based Slicer.' In: International Conference on Program Comprehension (ICPC) . 2016, pp. 1-3. DOI: 10.1109/icpc.2016.7503745.                                                                                       |
| [23]  | Q. Sti´venart, e D. Binkley, and C. De Roover. 'An Empirical Evaluation of Quasi-Static Executable Slices.' In: Journal of Systems and Software                                                                                                                                                                             |
| [24]  | 200 (2023), p. 111666. DOI: 10.1016/j.jss.2023.111666. B. Korel and J. Laski. 'Dynamic Program Slicing.' In: Information Processing Letters 29.3 (1988), pp. 155-163. DOI: 10.1016/0020-                                                                                                                                    |
| [25]  | 0190(88)90054-3. M. Weiser. 'Programmers Use Slices When Debugging.' In: Commu- nications of the ACM 25.7 (1982), pp. 446-452. DOI: 10.1145/358557. 358577.                                                                                                                                                                 |
| [26]  | N. Jiang, T. Lutellier, and L. Tan. 'CURE: Code-Aware Neural Machine Translation for Automatic Program Repair.' In: IEEE/ACM 43rd International Conference on Software Engineering (ICSE) . 2021,                                                                                                                           |
| [27]  | pp. 1161-1173. DOI: 10.1109/icse43902.2021.00107. H. Ye, M. Martinez, and M. Monperrus. 'Neural Program Repair with Execution-Based Backpropagation.' In: International Conference on                                                                                                                                       |

- [27] H. Ye, M. Martinez, and M. Monperrus. 'Neural Program Repair with Execution-Based Backpropagation.' In: International Conference on Software Engineering . ACM, 2022, pp. 1506-1518. DOI: 10.1145/ 3510003.3510222.

| [28]   | X. Meng, X. Wang, H. Zhang, H. Sun, X. Liu, and C. Hu. 'Template- Based Neural Program Repair.' In: IEEE/ACM 45th International Conference on Software Engineering (ICSE) . 2023, pp. 1456-1468. DOI: 10.1109/icse48619.2023.00127.                                                             |
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [29]   | N. Jiang, T. Lutellier, Y. Lou, L. Tan, D. Goldwasser, and X. Zhang. 'KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repair.' In: IEEE/ACM 45th International Conference on Software Engineering (ICSE) . 2023, pp. 1251-1263. DOI: 10.1109/ ICSE48619.2023.00111.         |
| [30]   | C. S. Xia, Y. Wei, and L. Zhang. 'Automated Program Repair in the Era of Large Pre-Trained Language Models.' In: International Conference on Software Engineering . regexpIEEE, 2023, pp. 1482-1494. DOI: 10. 1109/icse48619.2023.00129.                                                        |
| [31]   | L. Wang, B. Li, and X. Kong. 'Type Slicing: An Accurate Object Oriented Slicing Based on Sub-Statement Level Dependence Graph.' In: Information and Software Technology 127 (2020), p. 106369. DOI: 10.1016/j.infsof.2020.106369.                                                               |
| [32]   | K. Ahmed, M. Lis, and J. Rubin. 'Slicer4J: ADynamic Slicer for Java.' In: ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering . ACM, 2021, pp. 1570-1574. DOI: 10.1145/3468264.3473123.                                      |
| [33]   | Q. Sti´venart, e D. Binkley, and C. De Roover. 'QSES: Quasi-Static Executable Slices.' In: IEEE 21st International Working Conference on Source Code Analysis and Manipulation (SCAM) . 2021, pp. 209-213. DOI: 10.1109/SCAM52516.2021.00033.                                                   |
| [34]   | A. van Deursen, L. Moonen, A. van den Bergh, and G. Kok. 'Refac- toring Test Code.' In: Proceedings 2nd International Conference on Extreme Programming and Flexible Processes in Software Engineering (XP) . Ed. by M. Marchesi and G. Succi. 2001.                                            |
| [35]   | Y. Qi, X. Mao, Y. Lei, and C. Wang. 'Using Automated Program Re- pair for Evaluating the Effectiveness of Fault Localization Techniques.' In: International Symposium on Software Testing and Analysis . ACM, 2013, pp. 191-201. DOI: 10.1145/2483760.2483785.                                  |
| [36]   | L. Chen, Y. Pei, and C. A. Furia. 'Contract-Based Program Repair without the Contracts.' In: IEEE/ACM International Conference on Automated Software Engineering (ASE) . 2017, pp. 637-647. DOI: 10.                                                                                            |
| [37]   | 1109/ASE.2017.8115674. A. Ghanbari and L. Zhang. 'PraPR: Practical Program Repair via Bytecode Mutation.' In: IEEE/ACM International Conference on Au- tomated Software Engineering (ASE) . 2019, pp. 1118-1121. DOI: 10.                                                                       |
| [38]   | J. Campos, A. Riboira, A. Perez, and R. Abreu. 'GZoltar: An Eclipse Plug-in for Testing and Debugging.' In: IEEE/ACM International Conference on Automated Software Engineering . 2012, pp. 378-381. DOI: 10.1145/2351676.2351752.                                                              |
| [39]   | D. Zou, J. Liang, Y. Xiong, M. D. Ernst, and L. Zhang. 'An Empirical Study of Fault Localization Families and Their Combinations.' In: IEEE Transactions on Software Engineering 47.2 (2021), pp. 332-347. DOI: 10.1109/tse.2019.2892102.                                                       |
| [40]   | D. Binkley, N. Gold, S. Islam, J. Krinke, and S. Yoo. 'A Comparison of Tree- and Line-Oriented Observational Slicing.' In: Empirical Software Engineering 24.5 (2019), pp. 3077-3113. DOI: 10.1007/s10664-018- 9675-9.                                                                          |
| [41]   | E. Cruciani, B. Miranda, R. Verdecchia, and A. Bertolino. 'Scalable Approaches for Test Suite Reduction.' In: IEEE/ACM 41st Inter- national Conference on Software Engineering (ICSE) . IEEE, 2019, pp. 419-429. DOI: 10.1109/icse.2019.00055.                                                  |
| [42]   | Y. Tian and B. Ray. 'Automatically Diagnosing and Repairing Error Handling Bugs in C.' In: Joint Meeting on Foundations of Software Engineering . ACM, 2017, pp. 752-762. DOI: 10 . 1145 / 3106237 . 3106300.                                                                                   |
| [43]   | A. Afzal, M. Motwani, K. T. Stolee, Y. Brun, and C. Le Goues. 'SOSRepair: Expressive Semantic Search for Real-World Program Repair.' In: IEEE Transactions on Software Engineering 47.10 (2021),                                                                                                |
| [44]   | pp. 2162-2181. DOI: 10.1109/TSE.2019.2944914. S. Mechtaev, M.-D. Nguyen, Y. Noller, L. Grunske, and A. Roychoud- hury. 'Semantic Program Repair Using a Reference Implementation.' In: International Conference on Software Engineering . ACM, 2018, pp. 129-139. DOI: 10.1145/3180155.3180247. |
| [45]   | L. Chen, Y. Ouyang, and L. Zhang. 'Fast and Precise On-the-Fly Patch Validation for All.' In: IEEE/ACM 43rd International Conference on Software Engineering (ICSE) . 2021, pp. 1123-1134. DOI: 10.1109/                                                                                        |

| [46]   | R. Gupta, S. Pal, A. Kanade, and S. Shevade. 'DeepFix: Fixing Common C Language Errors by Deep Learning.' In: AAAI Conference on Artificial Intelligence . AAAI, 2017, pp. 1345-1351.                                                                                                                       |
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [47]   | Z. Qi, F. Long, S. Achour, and M. Rinard. 'An Analysis of Patch Plausibility and Correctness for Generate-and-Validate Patch Genera- tion Systems.' In: International Symposium on Software Testing and Analysis (ISSTA) . ACM, 2015, pp. 24-36. DOI: 10.1145/2771783. 2771791.                             |
| [48]   | Y. Xiong, X. Liu, M. Zeng, L. Zhang, and G. Huang. 'Identifying Patch Correctness in Test-Based Program Repair.' In: International Conference on Software Engineering . 2018, pp. 789-799. DOI: 10. 1145/3180155.3180182. arXiv: 1706.09120 [cs] .                                                          |
| [49]   | S. Yoo and M. Harman. 'Regression Testing Minimization, Selection and Prioritization: A Survey.' In: Software Testing, Verification and Reliability 22.2 (2012), pp. 67-120. DOI: 10.1002/stvr.430.                                                                                                         |
| [50]   | B. Mehne, H. Yoshida, M. R. Prasad, K. Sen, D. Gopinath, and S. Khurshid. 'Accelerating Search-Based Program Repair.' In: IEEE 11th International Conference on Software Testing, Verification and Validation (ICST) . 2018, pp. 227-238. DOI: 10.1109/ICST.2018.00031.                                     |
| [51]   | J. Liang, R. Ji, J. Jiang, S. Zhou, Y. Lou, Y. Xiong, and G. Huang. 'Interactive Patch Filtering as Debugging Aid.' In: IEEE International Conference on Software Maintenance and Evolution (ICSME) . 2021, pp. 239-250. DOI: 10.1109/ICSME52107.2021.00028.                                                |
| [52]   | C. Yang. 'Accelerating Redundancy-Based Program Repair via Code Representation Learning and Adaptive Patch Filtering.' In: ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering . ACM, 2021, pp. 1672-1674. DOI: 10.1145/3468264.3473496. |
| [53]   | S. Benton, Y. Xie, L. Lu, M. Zhang, X. Li, and L. Zhang. 'Towards Boosting Patch Execution On-the-Fly.' In: International Conference on Software Engineering (ICSE) . 2022, pp. 2165-2176. DOI: 10.1145/ 3510003.3510117.                                                                                   |
| [54]   | H. Ye and M. Monperrus. 'ITER: Iterative Neural Repair for Multi- Location Patches.' In: IEEE/ACM International Conference on Soft- ware Engineering . ACM, 2024, pp. 1-13. DOI: 10.1145/3597503. 3623337.                                                                                                  |
| [55]   | F. Y. Assiri and J. M. Bieman. 'Fault Localization for Automated Program Repair: Effectiveness, Performance, Repair Correctness.' In: Software Quality Journal 25.1 (2017), pp. 171-199. DOI: 10.1007/ s11219-016-9312-z.                                                                                   |
| [56]   | S. Pearson, J. Campos, R. Just, G. Fraser, R. Abreu, M. D. Ernst, D. Pang, and B. Keller. 'Evaluating and Improving Fault Localization.' In: IEEE/ACM 39th International Conference on Software Engineering (ICSE) . 2017, pp. 609-620. DOI: 10.1109/ICSE.2017.62.                                          |
| [57]   | D. Yang, Y. Qi, X. Mao, and Y. Lei. 'Evaluating the Usage of Fault Localization in Automated Program Repair: An Empirical Study.' In: Frontiers of Computer Science 15.1 (2020), p. 151202. DOI: 10.1007/ s11704-020-9263-1.                                                                                |
| [58]   | A. Christi, M. L. Olson, M. A. Alipour, and A. Groce. 'Reduce Before You Localize: Delta-Debugging and Spectrum-Based Fault Lo- calization.' In: IEEE International Symposium on Software Reliability Engineering Workshops (ISSREW) . 2018, pp. 184-191. DOI: 10.1109/ ISSREW.2018.00005.                  |
| [59]   | X. Zhang, N. Gupta, and R. Gupta. 'A Study of Effectiveness of Dynamic Slicing in Locating Real Faults.' In: Empirical Software Engineering 12.2 (2007), pp. 143-160. DOI: 10.1007/s10664- 006- 9007-3.                                                                                                     |
| [60]   | E. Alves, M. Gligoric, V. Jagannath, and M. d'Amorim. 'Fault- Localization Using Dynamic Slicing and Change Impact Analysis.' In: IEEE/ACM International Conference on Automated Software Engineer- ing (ASE 2011) . 2011, pp. 520-523. DOI: 10.1109/ASE.2011.6100114.                                      |
| [61]   | X. Li and A. Orso. 'More Accurate Dynamic Slicing for Better Supporting Software Debugging.' In: IEEE 13th International Con-                                                                                                                                                                               |

- ference on Software Testing, Validation and Verification (ICST) . 2020, pp. 28-38. DOI: 10.1109/ICST46399.2020.00014.

|      | pp. 28-38. DOI: 10.1109/ICST46399.2020.00014.                                                                                                                                                                                                                                                                                                        |
|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [62] | E. Soremekun, L. Kirschner, M. B¨hme, o and A. Zeller. 'Locating Faults with Program Slicing: An Empirical Analysis.' In: Empirical Software Engineering 26.3 (2021), p. 51. DOI: 10.1007/s10664-020- 09931-7.                                                                                                                                       |
| [63] | P. A. Soha. 'On The Efficiency Of Combination Of Program Slicing and Spectrum-Based Fault Localization.' In: IEEE Conference on Soft- ware Testing, Verification and Validation (ICST) . 2023, pp. 499-501. DOI: 10.1109/ICST57152.2023.00061.                                                                                                       |
| [64] | B. Liu, Lucia, S. Nejati, and L. C. Briand. 'Improving Fault Localiza- tion for Simulink Models Using Search-Based Testing and Prediction Models.' In: IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER) . 2017, pp. 359-370. DOI: 10. 1109/SANER.2017.7884636.                                           |
| [65] | M. Zhang, X. Li, L. Zhang, and S. Khurshid. 'Boosting Spectrum- Based Fault Localization Using PageRank.' In: ACM SIGSOFT Inter- national Symposium on Software Testing and Analysis . ACM, 2017, pp. 261-272. DOI: 10.1145/3092703.3092731.                                                                                                         |
| [66] | A. Guo, X. Mao, D. Yang, and S. Wang. 'An Empirical Study on the Effect of Dynamic Slicing on Automated Program Repair Efficiency.' In: IEEE International Conference on Software Maintenance and Evolution (ICSME) . 2018, pp. 554-558. DOI: 10.1109/icsme.2018. 00066.                                                                             |
| [67] | J. Xuan, M. Martinez, F. DeMarco, M. Cl´ment, e S. L. Marcote, T. Durieux, D. Le Berre, and M. Monperrus. 'Nopol: Automatic Repair of Conditional Statement Bugs in Java Programs.' In: IEEE Transactions on Software Engineering 43.1 (2017), pp. 34-55. DOI: 10.1109/tse. 2016.2560811.                                                            |
| [68] | M. Weiser. 'Program Slicing.' In: International Conference on Soft- ware Engineering (ICSE) . IEEE, 1981, pp. 439-449.                                                                                                                                                                                                                               |
| [69] | M. Harman and R. Hierons. 'An Overview of Program Slicing.' In: Software Focus 2.3 (2001), pp. 85-92. DOI: 10.1002/swf.41.                                                                                                                                                                                                                           |
| [70] | J. Silva. 'A Vocabulary of Program Slicing-Based Techniques.' In: ACM Computing Surveys 44.3 (2012), 12:1-12:41. DOI: 10 . 1145 / 2187671.2187674.                                                                                                                                                                                                   |
| [71] | S. Reis, R. Abreu, and M. D'Amorim. 'Demystifying the Combination of Dynamic Slicing and Spectrum-Based Fault Localization.' In: International Joint Conference on Artificial Intelligence . AAAI Press, 2019, pp. 4760-4766.                                                                                                                        |
| [72] | J. Hatcliff and M. Dwyer. 'Using the Bandera Tool Set to Model- Check Properties of Concurrent Java Software.' In: CONCUR 2001 - Concurrency Theory . Ed. by K. G. Larsen and M. Nielsen. Springer, 2001, pp. 39-58. DOI: 10.1007/3-540-44685-0 5.                                                                                                   |
| [73] | M. Chalupa, M. Vitovsk´, a T. Jaˇek, s M. ˇ Sim´ˇek, ac and J. Strejˇek. c 'Symbiotic 6: Generating Test Cases by Slicing and Symbolic Execution.' In: International Journal on Software Tools for Technology Transfer 23.6 (2021), pp. 875-877. DOI: 10.1007/s10009-020-00573- 0.                                                                   |
| [74] | M. B. Dwyer, J. Hatcliff, M. Hoosier, V. Ranganath, Robby, and T. Wallentine. 'Evaluating the Effectiveness of Slicing for Model Reduction of Concurrent Object-Oriented Programs.' In: Tools and Algorithms for the Construction and Analysis of Systems . Ed. by H. Hermanns and J. Palsberg. Springer, 2006, pp. 73-89. DOI: 10. 1007/11691372 5. |
| [75] | M. Chalupa and J. Strejˇek. c 'Evaluation of Program Slicing in Soft- ware Verification.' In: Integrated Formal Methods . Ed. by W. Ahrendt and S. L. Tapia Tarifa. Springer, 2019, pp. 101-119. DOI: 10.1007/978- 3-030-34968-4 6.                                                                                                                  |
| [76] | E. T. Barr, Y. Brun, P. Devanbu, M. Harman, and F. Sarro. 'The Plastic Surgery Hypothesis.' In: ACM SIGSOFT International Symposium on Foundations of Software Engineering . ACM, 2014, pp. 306-317. DOI: 10.1145/2635868.2635898.                                                                                                                   |
Linas Vidziunas David Binkley Leon Moonen
The Impact of Program Reduction on Automated Program Repair
Correcting bugs using modern Automated Program Repair (APR) can be both
time-consuming and resource-expensive. We describe a program repair approach
that aims to improve the scalability of modern APR tools. The approach
leverages program reduction in the form of program slicing to eliminate code
irrelevant to fixing the bug, which improves the APR tool's overall
performance. We investigate slicing's impact on all three phases of the repair
process: fault localization, patch generation, and patch validation. Our
empirical exploration finds that the proposed approach, on average, enhances
the repair ability of the TBar APR tool, but we also discovered a few cases
where it was less successful. Specifically, on examples from the widely used
Defects4J dataset, we obtain a substantial reduction in median repair time,
which falls from 80 minutes to just under 18 minutes. We conclude that program
reduction can improve the performance of APR without degrading repair quality,
but this improvement is not universal.
  A replication package is available via Zenodo at
https://doi.org/10.5281/zenodo.13074333.
  Keywords: automated program repair, dynamic program slicing, fault
localization, test-suite reduction, hybrid techniques.