nus-yam/ex-repair huggingface dataset:
Program: 100153
Project: 100153
Buggy source:
/** 
 * track a field of some instance key, as we are interested in statements that read or write to the field
 * @param ikAndState
 * @param field
 * @param ikToFields either  {@link #forwInstKeyToFields} or{@link #backInstKeyToFields}
 */
private void trackInstanceField(InstanceKeyAndState ikAndState,IField field,MultiMap<InstanceKeyAndState,IField> ikToFields){
  State state=ikAndState.getState();
  if (Assertions.verifyAssertions) {
    Assertions._assert(refineFieldAccesses(field));
  }
  ikToFields.put(ikAndState,field);
  for (Iterator<? extends Object> iter=g.getPredNodes(ikAndState.getInstanceKey(),NewLabel.v()); iter.hasNext(); ) {
    PointerKey ikPred=(PointerKey)iter.next();
    PointerKeyAndState ikPredAndState=new PointerKeyAndState(ikPred,state);
    int mappedIndex=ikAndStates.getMappedIndex(ikAndState);
    if (Assertions.verifyAssertions) {
      Assertions._assert(mappedIndex != -1);
    }
    if (findOrCreate(pkToTrackedSet,ikPredAndState).add(mappedIndex)) {
      addToTrackedPToWorklist(ikPredAndState);
    }
  }
}

Fixed version (ground truth):
/** 
 * track a field of some instance key, as we are interested in statements that read or write to the field
 * @param ikAndState
 * @param field
 * @param ikToFields either {@link #forwInstKeyToFields} or {@link #backInstKeyToFields}
 */
private void trackInstanceField(InstanceKeyAndState ikAndState,IField field,MultiMap<InstanceKeyAndState,IField> ikToFields){
  State state=ikAndState.getState();
  if (Assertions.verifyAssertions) {
    Assertions._assert(refineFieldAccesses(field));
  }
  ikToFields.put(ikAndState,field);
  for (Iterator<? extends Object> iter=g.getPredNodes(ikAndState.getInstanceKey(),NewLabel.v()); iter.hasNext(); ) {
    PointerKey ikPred=(PointerKey)iter.next();
    PointerKeyAndState ikPredAndState=new PointerKeyAndState(ikPred,state);
    int mappedIndex=ikAndStates.getMappedIndex(ikAndState);
    if (Assertions.verifyAssertions) {
      Assertions._assert(mappedIndex != -1);
    }
    if (findOrCreate(pkToTrackedSet,ikPredAndState).add(mappedIndex)) {
      addToTrackedPToWorklist(ikPredAndState);
    }
  }
}
Program: 100154
Project: 100154
Buggy source:
/** 
 * @param curPkAndState
 * @param predPk
 * @param label the label of the edge from curPk to predPk (must be barred)
 * @return those {@link PointerKeyAndState}s whose points-to sets have been queried, such that the   {@link PointerKey} is predPk, andtransitioning from its state on <code>label.bar()</code> yields the state of <code>curPkAndState</code>
 */
Collection<PointerKeyAndState> matchingPToQueried(PointerKeyAndState curPkAndState,PointerKey predPk,IFlowLabel label){
  Collection<PointerKeyAndState> ret=ArraySet.make();
  if (Assertions.verifyAssertions) {
    Assertions._assert(label.isBarred());
  }
  IFlowLabel unbarredLabel=label.bar();
  final State curState=curPkAndState.getState();
  Set<State> predPkStates=pointsToQueried.get(predPk);
  for (  State predState : predPkStates) {
    State transState=stateMachine.transition(predState,unbarredLabel);
    if (transState.equals(curState)) {
      ret.add(new PointerKeyAndState(predPk,predState));
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * @param curPkAndState
 * @param predPk
 * @param label the label of the edge from curPk to predPk (must be barred)
 * @return those {@link PointerKeyAndState}s whose points-to sets have been queried, such that the  {@link PointerKey} is predPk, and transitioning from its state on <code>label.bar()</code> yields thestate of <code>curPkAndState</code>
 */
Collection<PointerKeyAndState> matchingPToQueried(PointerKeyAndState curPkAndState,PointerKey predPk,IFlowLabel label){
  Collection<PointerKeyAndState> ret=ArraySet.make();
  if (Assertions.verifyAssertions) {
    Assertions._assert(label.isBarred());
  }
  IFlowLabel unbarredLabel=label.bar();
  final State curState=curPkAndState.getState();
  Set<State> predPkStates=pointsToQueried.get(predPk);
  for (  State predState : predPkStates) {
    State transState=stateMachine.transition(predState,unbarredLabel);
    if (transState.equals(curState)) {
      ret.add(new PointerKeyAndState(predPk,predState));
    }
  }
  return ret;
}
Program: 100155
Project: 100155
Buggy source:
void handleCopy(PointerKeyAndState curPkAndState,PointerKeyAndState succPkAndState){
  if (!addToInitWorklist(succPkAndState)) {
    if (addAllToP2Set(pkToP2Set,curPkAndState,find(pkToP2Set,succPkAndState))) {
      addToPToWorklist(curPkAndState);
    }
  }
}

Fixed version (ground truth):
void handleCopy(PointerKeyAndState curPkAndState,PointerKeyAndState succPkAndState,IFlowLabel label){
  if (!addToInitWorklist(succPkAndState)) {
    if (addAllToP2Set(pkToP2Set,curPkAndState,find(pkToP2Set,succPkAndState),label)) {
      addToPToWorklist(curPkAndState);
    }
  }
}
Program: 100158
Project: 100158
Buggy source:
void handleBackCopy(PointerKeyAndState curPkAndState,PointerKey predPk,IFlowLabel label){
  for (  PointerKeyAndState predPkAndState : matchingPToQueried(curPkAndState,predPk,label)) {
    if (addAllToP2Set(pkToP2Set,predPkAndState,find(pkToP2Set,curPkAndState))) {
      addToPToWorklist(predPkAndState);
    }
  }
}

Fixed version (ground truth):
void handleBackCopy(PointerKeyAndState curPkAndState,PointerKey predPk,IFlowLabel label){
  for (  PointerKeyAndState predPkAndState : matchingPToQueried(curPkAndState,predPk,label)) {
    if (addAllToP2Set(pkToP2Set,predPkAndState,find(pkToP2Set,curPkAndState),label)) {
      addToPToWorklist(predPkAndState);
    }
  }
}
Program: 100161
Project: 100161
Buggy source:
/** 
 * handle possible updated flow in both directions for a call parameter
 * @param src
 * @param dst
 */
private void repropCallArg(PointerKeyAndState src,PointerKeyAndState dst,IFlowLabel dstToSrcLabel){
  for (  PointerKeyAndState srcToHandle : matchingPToQueried(dst,src.getPointerKey(),dstToSrcLabel)) {
    handleCopy(srcToHandle,dst);
  }
  IntSet trackedSet=find(pkToTrackedSet,dst);
  if (!trackedSet.isEmpty()) {
    if (findOrCreate(pkToTrackedSet,src).addAll(trackedSet)) {
      addToTrackedPToWorklist(src);
    }
  }
}

Fixed version (ground truth):
/** 
 * handle possible updated flow in both directions for a call parameter
 * @param src
 * @param dst
 */
private void repropCallArg(PointerKeyAndState src,PointerKeyAndState dst,IFlowLabel dstToSrcLabel){
  for (  PointerKeyAndState srcToHandle : matchingPToQueried(dst,src.getPointerKey(),dstToSrcLabel)) {
    handleCopy(srcToHandle,dst,dstToSrcLabel.bar());
  }
  IntSet trackedSet=find(pkToTrackedSet,dst);
  if (!trackedSet.isEmpty()) {
    if (findOrCreate(pkToTrackedSet,src).addAll(trackedSet)) {
      addToTrackedPToWorklist(src);
    }
  }
}
Program: 100162
Project: 100162
Buggy source:
@Override public void visitAssign(AssignLabel label,Object dst){
  final PointerKey predPk=(PointerKey)dst;
  doTransition(curState,AssignBarLabel.v(),new Function<State,Object>(){
    public Object apply(    State predPkState){
      PointerKeyAndState predPkAndState=new PointerKeyAndState(predPk,predPkState);
      if (findOrCreate(pkToTrackedSet,predPkAndState).addAll(trackedSet)) {
        addToTrackedPToWorklist(predPkAndState);
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
@Override public void visitAssign(AssignLabel label,Object dst){
  final PointerKey predPk=(PointerKey)dst;
  doTransition(curState,AssignBarLabel.noFilter(),new Function<State,Object>(){
    public Object apply(    State predPkState){
      PointerKeyAndState predPkAndState=new PointerKeyAndState(predPk,predPkState);
      if (findOrCreate(pkToTrackedSet,predPkAndState).addAll(trackedSet)) {
        addToTrackedPToWorklist(predPkAndState);
      }
      return null;
    }
  }
);
}
Program: 100164
Project: 100164
Buggy source:
private boolean addAllToP2Set(Map<PointerKeyAndState,MutableIntSet> p2setMap,PointerKeyAndState pkAndState,IntSet vals){
}

Fixed version (ground truth):
private boolean addAllToP2Set(Map<PointerKeyAndState,MutableIntSet> p2setMap,PointerKeyAndState pkAndState,IntSet vals,IFlowLabel label){
  final PointerKey pk=pkAndState.getPointerKey();
  if (pk instanceof FilteredPointerKey) {
    if (DEBUG) {
      Trace.println("String_Node_Str" + pk);
    }
    final TypeFilter typeFilter=((FilteredPointerKey)pk).getTypeFilter();
    vals=updateValsForFilter(vals,typeFilter);
  }
  if (label instanceof IFlowLabelWithFilter) {
    TypeFilter typeFilter=((IFlowLabelWithFilter)label).getFilter();
    if (typeFilter != null) {
      vals=updateValsForFilter(vals,typeFilter);
    }
  }
  boolean added=findOrCreate(p2setMap,pkAndState).addAll(vals);
  if (DEBUG && added) {
    Trace.println("String_Node_Str" + pkAndState + "String_Node_Str");
    for (    InstanceKeyAndState ikAndState : makeOrdinalSet(vals)) {
      Trace.println(ikAndState);
    }
    Trace.println("String_Node_Str");
  }
  return added;
}
Program: 100165
Project: 100165
Buggy source:
public AbstractDemandFlowGraph(final CallGraph cg,final HeapModel heapModel,final MemoryAccessMap mam,final ClassHierarchy cha){
  this.cg=cg;
  this.heapModel=heapModel;
  this.mam=mam;
  this.cha=cha;
}

Fixed version (ground truth):
public AbstractDemandFlowGraph(final CallGraph cg,final HeapModel heapModel,final MemoryAccessMap mam,final ClassHierarchy cha){
  super(mam,heapModel);
  this.cg=cg;
  this.cha=cha;
}
Program: 100166
Project: 100166
Buggy source:
public Set<CGNode> getPossibleTargets(CGNode node,CallSiteReference site){
  return cg.getPossibleTargets(node,site);
}

Fixed version (ground truth):
public Set<CGNode> getPossibleTargets(CGNode node,CallSiteReference site,LocalPointerKey actualPk){
  return cg.getPossibleTargets(node,site);
}
Program: 100167
Project: 100167
Buggy source:
private void addPhiConstraints(CGNode node,ControlFlowGraph<ISSABasicBlock> cfg,ISSABasicBlock b){
  for (Iterator<? extends IBasicBlock> iter=cfg.getSuccNodes(b); iter.hasNext(); ) {
    ISSABasicBlock sb=(ISSABasicBlock)iter.next();
    if (sb.isExitBlock()) {
      continue;
    }
    int n=0;
    for (Iterator<? extends IBasicBlock> back=cfg.getPredNodes(sb); back.hasNext(); n++) {
      if (back.next() == b) {
        break;
      }
    }
    if (DEBUG && Assertions.verifyAssertions) {
      Assertions._assert(n < cfg.getPredNodeCount(sb));
    }
    for (Iterator<SSAPhiInstruction> phis=sb.iteratePhis(); phis.hasNext(); ) {
      SSAPhiInstruction phi=phis.next();
      if (phi == null) {
        continue;
      }
      PointerKey def=heapModel.getPointerKeyForLocal(node,phi.getDef());
      if (phi.getUse(n) > 0) {
        PointerKey use=heapModel.getPointerKeyForLocal(node,phi.getUse(n));
        addNode(def);
        addNode(use);
        addEdge(def,use,AssignLabel.v());
      }
    }
  }
}

Fixed version (ground truth):
private void addPhiConstraints(CGNode node,ControlFlowGraph<ISSABasicBlock> cfg,ISSABasicBlock b){
  for (Iterator<? extends IBasicBlock> iter=cfg.getSuccNodes(b); iter.hasNext(); ) {
    ISSABasicBlock sb=(ISSABasicBlock)iter.next();
    if (sb.isExitBlock()) {
      continue;
    }
    int n=0;
    for (Iterator<? extends IBasicBlock> back=cfg.getPredNodes(sb); back.hasNext(); n++) {
      if (back.next() == b) {
        break;
      }
    }
    if (DEBUG && Assertions.verifyAssertions) {
      Assertions._assert(n < cfg.getPredNodeCount(sb));
    }
    for (Iterator<SSAPhiInstruction> phis=sb.iteratePhis(); phis.hasNext(); ) {
      SSAPhiInstruction phi=phis.next();
      if (phi == null) {
        continue;
      }
      PointerKey def=heapModel.getPointerKeyForLocal(node,phi.getDef());
      if (phi.getUse(n) > 0) {
        PointerKey use=heapModel.getPointerKeyForLocal(node,phi.getUse(n));
        addNode(def);
        addNode(use);
        addEdge(def,use,AssignLabel.noFilter());
      }
    }
  }
}
Program: 100169
Project: 100169
Buggy source:
public static ApplicationWindow run(String classpath){
  try {
    AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath,new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
    ClassHierarchy cha=ClassHierarchy.make(scope);
    Graph<IClass> g=typeHierarchy2Graph(cha);
    g=pruneForAppLoader(g);
    final SWTTreeViewer v=new SWTTreeViewer();
    v.setGraphInput(g);
    Collection<IClass> roots=InferGraphRoots.inferRoots(g);
    if (roots.size() < 1) {
      System.err.println("String_Node_Str" + roots.size());
      System.exit(-1);
    }
    v.setRootsInput(roots);
    v.run();
    return v.getApplicationWindow();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
public static ApplicationWindow run(String classpath){
  try {
    AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath,FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
    ClassHierarchy cha=ClassHierarchy.make(scope);
    Graph<IClass> g=typeHierarchy2Graph(cha);
    g=pruneForAppLoader(g);
    final SWTTreeViewer v=new SWTTreeViewer();
    v.setGraphInput(g);
    Collection<IClass> roots=InferGraphRoots.inferRoots(g);
    if (roots.size() < 1) {
      System.err.println("String_Node_Str" + roots.size());
      System.exit(-1);
    }
    v.setRootsInput(roots);
    v.run();
    return v.getApplicationWindow();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}
Program: 100171
Project: 100171
Buggy source:
/** 
 * Walk through the instructions and compute basic block boundaries.
 */
private void makeBasicBlocks(){
  BasicBlock entry=new BasicBlock(-1,-2);
  addNode(entry);
  this.entry=entry;
  SSAInstruction[] instructions=(SSAInstruction[])getInstructions();
  if (instructions.length > 0) {
    final boolean[] r=new boolean[instructions.length];
    r[0]=true;
    BranchVisitor branchVisitor=makeBranchVisitor(r);
    PEIVisitor peiVisitor=makePEIVisitor(r);
    for (int i=0; i < instructions.length; i++) {
      if (instructions[i] != null) {
        branchVisitor.setIndex(i);
        instructions[i].visit(branchVisitor);
        peiVisitor.setIndex(i);
        instructions[i].visit(peiVisitor);
      }
    }
    BasicBlock b=null;
    for (int i=0; i < r.length; i++) {
      if (r[i]) {
        int end=instructions.length - 1;
        for (int j=i; j < instructions.length; j++) {
          if (r[j]) {
            end=j;
            break;
          }
        }
        b=new BasicBlock(i,end);
        addNode(b);
      }
      i2block[i]=b;
    }
  }
  BasicBlock exit=new BasicBlock(-3,-4);
  addNode(exit);
  this.exit=exit;
}

Fixed version (ground truth):
/** 
 * Walk through the instructions and compute basic block boundaries.
 */
private void makeBasicBlocks(){
  BasicBlock entry=new BasicBlock(-1,-2);
  addNode(entry);
  this.entry=entry;
  SSAInstruction[] instructions=(SSAInstruction[])getInstructions();
  if (instructions.length > 0) {
    final boolean[] r=new boolean[instructions.length];
    r[0]=true;
    BranchVisitor branchVisitor=makeBranchVisitor(r);
    PEIVisitor peiVisitor=makePEIVisitor(r);
    for (int i=0; i < instructions.length; i++) {
      if (instructions[i] != null) {
        branchVisitor.setIndex(i);
        instructions[i].visit(branchVisitor);
        peiVisitor.setIndex(i);
        instructions[i].visit(peiVisitor);
      }
    }
    BasicBlock b=null;
    for (int i=0; i < r.length; i++) {
      if (r[i]) {
        int end=instructions.length - 1;
        for (int j=i + 1; j < instructions.length; j++) {
          if (r[j]) {
            end=j;
            break;
          }
        }
        b=new BasicBlock(i,end);
        addNode(b);
      }
      i2block[i]=b;
    }
  }
  BasicBlock exit=new BasicBlock(-3,-4);
  addNode(exit);
  this.exit=exit;
}
Program: 100172
Project: 100172
Buggy source:
/** 
 * Initialize the visitor used to perform the flow functions
 */
protected void init(BasicStackMachineVisitor v,com.ibm.wala.shrikeBT.Instruction.Visitor ev){
  this.visitor=v;
  this.edgeVisitor=ev;
}

Fixed version (ground truth):
/** 
 * Initialize the visitors used to perform the flow functions
 */
protected void init(BasicStackMachineVisitor v,com.ibm.wala.shrikeBT.Instruction.Visitor ev){
  this.visitor=v;
  this.edgeVisitor=ev;
}
Program: 100173
Project: 100173
Buggy source:
@Override public int hashCode(){
  return 3691 * phi.hashCode() + getNode().hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return 3691 * phi.getDef() + getNode().hashCode();
}
Program: 100174
Project: 100174
Buggy source:
@Override public int hashCode(){
  return 3691 * pi.hashCode() + getNode().hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return 3691 * pi.getDef() + getNode().hashCode();
}
Program: 100175
Project: 100175
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass().equals(obj.getClass())) {
    PiStatement other=(PiStatement)obj;
    return getNode().equals(other.getNode()) && pi.equals(other.pi);
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass().equals(obj.getClass())) {
    PiStatement other=(PiStatement)obj;
    return getNode().equals(other.getNode()) && pi.getDef() == other.getPi().getDef();
  }
 else {
    return false;
  }
}
Program: 100176
Project: 100176
Buggy source:
public Pair<Integer,SSAInstruction> getPi(SSAConditionalBranchInstruction cond,SSAInstruction def1,SSAInstruction def2,SymbolTable symbolTable){
  Pair<Integer,SSAInstruction> result=p1.getPi(cond,def1,def2,symbolTable);
  if (result != null) {
    return result;
  }
  return p2.getPi(cond,def1,def2,symbolTable);
}

Fixed version (ground truth):
public Pair<Integer,SSAInstruction> getPi(SSAAbstractInvokeInstruction call,SymbolTable symbolTable){
  Pair<Integer,SSAInstruction> result=p1.getPi(call,symbolTable);
  if (result != null) {
    return result;
  }
  return p2.getPi(call,symbolTable);
}
Program: 100177
Project: 100177
Buggy source:
public Pair<Integer,SSAInstruction> getPi(SSAConditionalBranchInstruction cond,SSAInstruction def1,SSAInstruction def2,SymbolTable symbolTable){
  if (def1 instanceof SSAInstanceofInstruction) {
    if (symbolTable.isBooleanOrZeroOneConstant(cond.getUse(1))) {
      return Pair.make(def1.getUse(0),def1);
    }
  }
  if (def2 instanceof SSAInstanceofInstruction) {
    if (symbolTable.isBooleanOrZeroOneConstant(cond.getUse(0))) {
      return Pair.make(def2.getUse(0),def2);
    }
  }
  return null;
}

Fixed version (ground truth):
public Pair<Integer,SSAInstruction> getPi(SSAAbstractInvokeInstruction call,SymbolTable symbolTable){
  return null;
}
Program: 100178
Project: 100178
Buggy source:
public Pair<Integer,SSAInstruction> getPi(SSAConditionalBranchInstruction cond,SSAInstruction def1,SSAInstruction def2,SymbolTable symbolTable){
  if (symbolTable.isNullConstant(cond.getUse(1))) {
    return Pair.<Integer,SSAInstruction>make(cond.getUse(0),cond);
  }
  if (symbolTable.isNullConstant(cond.getUse(0))) {
    return Pair.<Integer,SSAInstruction>make(cond.getUse(1),cond);
  }
  return null;
}

Fixed version (ground truth):
public Pair<Integer,SSAInstruction> getPi(SSAAbstractInvokeInstruction call,SymbolTable symbolTable){
  return null;
}
Program: 100179
Project: 100179
Buggy source:
/** 
 * @see com.ibm.wala.shrikeBT.Instruction.Visitor#visitSwitch(SwitchInstruction)
 */
@Override public void visitSwitch(com.ibm.wala.shrikeBT.SwitchInstruction instruction){
}

Fixed version (ground truth):
/** 
 * @see com.ibm.wala.shrikeBT.Instruction.Visitor#visitSwitch(SwitchInstruction)
 */
@Override public void visitSwitch(com.ibm.wala.shrikeBT.SwitchInstruction instruction){
  int val=workingState.pop();
  emitInstruction(new SSASwitchInstruction(val,instruction.getDefaultLabel(),instruction.getCasesAndLabels()));
}
Program: 100180
Project: 100180
Buggy source:
/** 
 * @see com.ibm.wala.shrikeBT.Instruction.Visitor#visitInvoke(InvokeInstruction)
 */
@Override public void visitInvoke(com.ibm.wala.shrikeBT.InvokeInstruction instruction){
  int n=instruction.getPoppedCount();
  int[] params=new int[n];
  for (int i=n - 1; i >= 0; i--) {
    params[i]=workingState.pop();
  }
  MethodReference m=MethodReference.findOrCreate(loader,instruction.getClassType(),instruction.getMethodName(),instruction.getMethodSignature());
  IInvokeInstruction.Dispatch code=ShrikeUtil.getInvocationCode(instruction);
  CallSiteReference site=CallSiteReference.make(getCurrentProgramCounter(),m,code);
  int exc=reuseOrCreateException();
  if (instruction.getPushedWordSize() > 0) {
    int result=reuseOrCreateDef();
    workingState.push(result);
    emitInstruction(new SSAInvokeInstruction(result,params,exc,site));
  }
 else {
    emitInstruction(new SSAInvokeInstruction(params,exc,site));
  }
}

Fixed version (ground truth):
@Override public void visitInvoke(InvokeInstruction instruction){
  maybeInsertPi((SSAAbstractInvokeInstruction)getCurrentInstruction());
}
Program: 100181
Project: 100181
Buggy source:
private void maybeInsertPi(SSAConditionalBranchInstruction cond){
  if (piNodePolicy != null) {
    Pair<Integer,SSAInstruction> pi=piNodePolicy.getPi(cond,creators[cond.getUse(0)],creators[cond.getUse(1)],symbolTable);
    if (pi != null) {
      reuseOrCreatePi(pi.snd,pi.fst);
    }
  }
}

Fixed version (ground truth):
private void maybeInsertPi(SSAConditionalBranchInstruction cond){
  if (piNodePolicy != null) {
    Pair<Integer,SSAInstruction> pi=piNodePolicy.getPi(cond,getDef(cond.getUse(0)),getDef(cond.getUse(1)),symbolTable);
    if (pi != null) {
      reuseOrCreatePi(pi.snd,pi.fst);
    }
  }
}
Program: 100182
Project: 100182
Buggy source:
/** 
 * @param index -index into IR instruction array
 * @param vn -value number
 */
public String[] getLocalNames(int index,int vn){
  try {
    if (!shrikeCFG.getMethod().hasLocalVariableTable()) {
      return null;
    }
 else {
      int[] localNumbers=findLocalsForValueNumber(index,vn);
      if (localNumbers == null) {
        return null;
      }
 else {
        ShrikeCTMethod m=(ShrikeCTMethod)shrikeCFG.getMethod();
        String[] result=new String[localNumbers.length];
        for (int i=0; i < localNumbers.length; i++) {
          result[i]=m.getLocalVariableName(m.getBytecodeIndex(index),localNumbers[i]);
        }
        return result;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assertions.UNREACHABLE();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * @param index - index into IR instruction array
 * @param vn - value number
 */
public String[] getLocalNames(int index,int vn){
  try {
    if (!shrikeCFG.getMethod().hasLocalVariableTable()) {
      return null;
    }
 else {
      int[] localNumbers=findLocalsForValueNumber(index,vn);
      if (localNumbers == null) {
        return null;
      }
 else {
        ShrikeCTMethod m=(ShrikeCTMethod)shrikeCFG.getMethod();
        String[] result=new String[localNumbers.length];
        for (int i=0; i < localNumbers.length; i++) {
          result[i]=m.getLocalVariableName(m.getBytecodeIndex(index),localNumbers[i]);
        }
        return result;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    Assertions.UNREACHABLE();
    return null;
  }
}
Program: 100183
Project: 100183
Buggy source:
/** 
 * @param piCause
 * @param ref
 */
private void reuseOrCreatePi(SSAInstruction piCause,int ref){
  int n=getCurrentInstructionIndex();
  SSACFG.BasicBlock bb=cfg.getBlockForInstruction(n);
  BasicBlock path=getCurrentSuccessor();
  int outNum=shrikeCFG.getNumber(path);
  SSAPiInstruction pi=bb.getPiForRefAndPath(ref,path);
  if (pi == null) {
    pi=new SSAPiInstruction(symbolTable.newSymbol(),ref,outNum,piCause);
    bb.addPiForRefAndPath(ref,path,pi);
  }
  workingState.replaceValue(ref,pi.getDef());
}

Fixed version (ground truth):
/** 
 * @param piCause
 * @param ref
 */
private void reuseOrCreatePi(SSAInstruction piCause,int ref){
  int n=getCurrentInstructionIndex();
  SSACFG.BasicBlock bb=cfg.getBlockForInstruction(n);
  BasicBlock path=getCurrentSuccessor();
  int outNum=shrikeCFG.getNumber(path);
  SSAPiInstruction pi=bb.getPiForRefAndPath(ref,path);
  if (pi == null) {
    pi=new SSAPiInstruction(symbolTable.newSymbol(),ref,bb.getNumber(),outNum,piCause);
    bb.addPiForRefAndPath(ref,path,pi);
  }
  workingState.replaceValue(ref,pi.getDef());
}
Program: 100184
Project: 100184
Buggy source:
/** 
 * @param pc a program counter (index into ShrikeBT instruction array)
 * @param vn a value number
 * @return if we know that immediately after the given program counter, v_vncorresponds to some set of locals, then return an array of the local numbers. else return null.
 */
private int[] findLocalsForValueNumber(int pc,int vn){
  IBasicBlock bb=shrikeCFG.getBlockForInstruction(pc);
  int firstInstruction=bb.getFirstInstructionIndex();
  int[] locals=block2LocalState[bb.getNumber()];
  if (locals == null) {
    locals=allocateNewLocalsArray();
  }
  for (int i=firstInstruction; i <= pc; i++) {
    if (localStoreMap[i] != null) {
      IntPair p=localStoreMap[i];
      locals[p.getY()]=p.getX();
    }
  }
  return extractIndices(locals,vn);
}

Fixed version (ground truth):
/** 
 * @param pc a program counter (index into ShrikeBT instruction array)
 * @param vn a value number
 * @return if we know that immediately after the given program counter, v_vn corresponds to some set of locals, thenreturn an array of the local numbers. else return null.
 */
private int[] findLocalsForValueNumber(int pc,int vn){
  IBasicBlock bb=shrikeCFG.getBlockForInstruction(pc);
  int firstInstruction=bb.getFirstInstructionIndex();
  int[] locals=block2LocalState[bb.getNumber()];
  if (locals == null) {
    locals=allocateNewLocalsArray();
  }
  for (int i=firstInstruction; i <= pc; i++) {
    if (localStoreMap[i] != null) {
      IntPair p=localStoreMap[i];
      locals[p.getY()]=p.getX();
    }
  }
  return extractIndices(locals,vn);
}
Program: 100185
Project: 100185
Buggy source:
@Override public SSAInstruction copyForSSA(int[] defs,int[] uses){
  if (defs != null && defs.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (uses != null && uses.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new SSAPiInstruction(defs == null ? result : defs[0],uses == null ? val : uses[0],successorBlock,cause);
}

Fixed version (ground truth):
@Override public SSAInstruction copyForSSA(int[] defs,int[] uses){
  if (defs != null && defs.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (uses != null && uses.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new SSAPiInstruction(defs == null ? result : defs[0],uses == null ? val : uses[0],piBlock,successorBlock,cause);
}
Program: 100186
Project: 100186
Buggy source:
/** 
 * @param s the successor block; this PI assignment happens on the transition between this basic block andthe successor block.
 */
SSAPiInstruction(int result,int val,int s,SSAInstruction cause){
  super(null,result,val);
  this.cause=cause;
  this.successorBlock=s;
}

Fixed version (ground truth):
/** 
 * @param s the successor block; this PI assignment happens on the transition between this basic block andthe successor block.
 */
SSAPiInstruction(int result,int val,int piBlock,int s,SSAInstruction cause){
  super(null,result,val);
  this.cause=cause;
  this.successorBlock=s;
  this.piBlock=piBlock;
}
Program: 100188
Project: 100188
Buggy source:
/** 
 * @param call
 * @param node
 * @param constParams if non-null, then constParams[i] holds the String constant that is passed as param i, or null if param i is not a String constant
 */
DispatchOperator(SSAAbstractInvokeInstruction call,ExplicitCallGraph.ExplicitNode node,InstanceKey[][] constParams,PointerKey uniqueCatch){
  this.call=call;
  this.node=node;
  this.constParams=constParams;
  this.uniqueCatch=uniqueCatch;
}

Fixed version (ground truth):
/** 
 * @param call
 * @param node
 * @param constParams if non-null, then constParams[i] holds the String constant that is passed as param i, or nullif param i is not a String constant
 */
DispatchOperator(SSAAbstractInvokeInstruction call,ExplicitCallGraph.ExplicitNode node,InstanceKey[][] constParams,PointerKey uniqueCatch){
  this.call=call;
  this.node=node;
  this.constParams=constParams;
  this.uniqueCatch=uniqueCatch;
}
Program: 100189
Project: 100189
Buggy source:
private int booleanConstantTest(SSAConditionalBranchInstruction c,int v){
  int result=0;
  if ((symbolTable.isZeroOrFalse(c.getUse(0)) && c.getUse(1) == v) || (symbolTable.isZeroOrFalse(c.getUse(1)) && c.getUse(0) == v)) {
    result=-1;
  }
 else   if ((symbolTable.isOneOrTrue(c.getUse(0)) && c.getUse(1) == v) || (symbolTable.isOneOrTrue(c.getUse(1)) && c.getUse(0) == v)) {
    result=1;
  }
  if (c.getOperator() == ConditionalBranchInstruction.Operator.NE) {
    result=-result;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * TODO: What is this doing? Document me!
 */
private int booleanConstantTest(SSAConditionalBranchInstruction c,int v){
  int result=0;
  if ((symbolTable.isZeroOrFalse(c.getUse(0)) && c.getUse(1) == v) || (symbolTable.isZeroOrFalse(c.getUse(1)) && c.getUse(0) == v)) {
    result=-1;
  }
 else   if ((symbolTable.isOneOrTrue(c.getUse(0)) && c.getUse(1) == v) || (symbolTable.isOneOrTrue(c.getUse(1)) && c.getUse(0) == v)) {
    result=1;
  }
  if (c.getOperator() == ConditionalBranchInstruction.Operator.NE) {
    result=-result;
  }
  return result;
}
Program: 100192
Project: 100192
Buggy source:
/** 
 * @param appJar something like "c:/temp/testdata/java_cup.jar"
 * @return a call graph
 * @throws CancelException
 * @throws IllegalArgumentException
 */
public static Graph<CGNode> buildPrunedCallGraph(String appJar,File exclusionFile) throws WalaException, IllegalArgumentException, CancelException {
  AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,exclusionFile != null ? exclusionFile : new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha);
  AnalysisOptions options=new AnalysisOptions(scope,entrypoints);
  com.ibm.wala.ipa.callgraph.CallGraphBuilder builder=Util.makeZeroOneContainerCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options);
  System.err.println(CallGraphStats.getStats(cg));
  Graph<CGNode> g=pruneForAppLoader(cg);
  return g;
}

Fixed version (ground truth):
/** 
 * @param appJar something like "c:/temp/testdata/java_cup.jar"
 * @return a call graph
 * @throws CancelException
 * @throws IllegalArgumentException
 */
public static Graph<CGNode> buildPrunedCallGraph(String appJar,File exclusionFile) throws WalaException, IllegalArgumentException, CancelException {
  AnalysisScope scope=AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar,exclusionFile != null ? exclusionFile : new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha);
  AnalysisOptions options=new AnalysisOptions(scope,entrypoints);
  com.ibm.wala.ipa.callgraph.CallGraphBuilder builder=Util.makeZeroCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options);
  System.err.println(CallGraphStats.getStats(cg));
  Graph<CGNode> g=pruneForAppLoader(cg);
  return g;
}
Program: 100193
Project: 100193
Buggy source:
/** 
 * Get the WCCM archive representing a particular module
 * @param M the module to analyze
 * @return Archive, or null if no WCCM conversion is possible
 */
@SuppressWarnings("String_Node_Str") public static Archive getArchive(Module M){
  CommonarchiveFactory factory=CommonarchiveFactoryImpl.getActiveFactory();
  try {
    if (M instanceof JarFileModule) {
      String fileName=((JarFileModule)M).getAbsolutePath();
      return factory.openArchive(fileName);
    }
 else     if (M instanceof TopLevelArchiveModule) {
      TopLevelArchiveModule AM=(TopLevelArchiveModule)M;
      return AM.materializeArchive();
    }
 else     if (M instanceof ClassFileModule) {
      return null;
    }
 else {
      Assertions.UNREACHABLE("String_Node_Str" + M.getClass());
      return null;
    }
  }
 catch (  OpenFailureException e) {
    e.printStackTrace();
    Assertions.UNREACHABLE();
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Get the WCCM archive representing a particular module
 * @param M the module to analyze
 * @return Archive, or null if no WCCM conversion is possible
 */
@SuppressWarnings("String_Node_Str") public static Archive getArchive(Module M){
  CommonarchiveFactory factory=CommonarchiveFactoryImpl.getActiveFactory();
  try {
    if (M instanceof JarFileModule) {
      String fileName=((JarFileModule)M).getAbsolutePath();
      return factory.openArchive(fileName);
    }
 else     if (M instanceof TopLevelArchiveModule) {
      TopLevelArchiveModule AM=(TopLevelArchiveModule)M;
      return AM.materializeArchive();
    }
 else     if (M instanceof ClassFileModule) {
      return null;
    }
 else {
      return null;
    }
  }
 catch (  OpenFailureException e) {
    e.printStackTrace();
    Assertions.UNREACHABLE();
    return null;
  }
}
Program: 100194
Project: 100194
Buggy source:
public boolean understands(CGNode node){
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return getTypesForContext(node.getContext()) != null;
}

Fixed version (ground truth):
public boolean understands(CGNode node){
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (node.getMethod().isSynthetic()) {
    SyntheticMethod s=(SyntheticMethod)node.getMethod();
    if (s.isFactoryMethod()) {
      return getTypesForContext(node.getContext()) != null;
    }
  }
  return false;
}
Program: 100195
Project: 100195
Buggy source:
/** 
 * Dump stats about the class hierarchy to stdout.
 * @param cha
 */
public static void printStats(ClassHierarchy cha) throws IllegalArgumentException {
  if (cha == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IClassLoader[] loaders=cha.getLoaders();
  for (int i=0; i < loaders.length; i++) {
    System.out.println("String_Node_Str" + loaders[i]);
    System.out.println("String_Node_Str" + loaders[i].getNumberOfClasses());
    System.out.println("String_Node_Str" + loaders[i].getNumberOfMethods());
  }
}

Fixed version (ground truth):
/** 
 * Dump stats about the class hierarchy to stdout.
 * @param cha
 */
public static void printStats(IClassHierarchy cha) throws IllegalArgumentException {
  if (cha == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  IClassLoader[] loaders=cha.getLoaders();
  for (int i=0; i < loaders.length; i++) {
    System.out.println("String_Node_Str" + loaders[i]);
    System.out.println("String_Node_Str" + loaders[i].getNumberOfClasses());
    System.out.println("String_Node_Str" + loaders[i].getNumberOfMethods());
  }
}
Program: 100196
Project: 100196
Buggy source:
/** 
 * Does m represent a static factory method we know about from the standard libraries, that we usually wish to model with one level of call-string context?
 */
public static boolean isWellKnownStaticFactory(MethodReference m){
  if (m.equals(synthArraycopy)) {
    return true;
  }
  if (m.equals(ArraysAsList)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Does m represent a static factory method we know about from the standard libraries, that we usually wish to model with one level of call-string context?
 */
public static boolean isWellKnownStaticFactory(MethodReference m){
  if (m.getDeclaringClass().equals(TypeReference.JavaLangSystem)) {
    if (m.getName().toString().equals("String_Node_Str")) {
      return true;
    }
  }
  if (m.equals(synthArraycopy)) {
    return true;
  }
  if (m.equals(ArraysAsList)) {
    return true;
  }
  return false;
}
Program: 100197
Project: 100197
Buggy source:
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
  AnalysisScope scope=CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,TestConstants.SLICE2_MAIN);
  AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
  CallGraphBuilder builder=Util.makeZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options);
  CGNode main=findMethod(cg,"String_Node_Str");
  Statement s=findCallTo(main,"String_Node_Str");
  System.err.println("String_Node_Str" + s);
  Collection<Statement> computeBackwardSlice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),DataDependenceOptions.FULL,ControlDependenceOptions.NONE);
  Collection<Statement> slice=computeBackwardSlice;
  dumpSlice(slice);
  assertEquals(22,slice.size());
}

Fixed version (ground truth):
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
  AnalysisScope scope=CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,TestConstants.SLICE2_MAIN);
  AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
  CallGraphBuilder builder=Util.makeZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options);
  CGNode main=findMethod(cg,"String_Node_Str");
  Statement s=findCallTo(main,"String_Node_Str");
  System.err.println("String_Node_Str" + s);
  Collection<Statement> computeBackwardSlice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),DataDependenceOptions.FULL,ControlDependenceOptions.NONE);
  Collection<Statement> slice=computeBackwardSlice;
  dumpSlice(slice);
  assertEquals(30,slice.size());
}
Program: 100198
Project: 100198
Buggy source:
/** 
 * For a statement s, compute the set of statements that may def the heap value read by s.
 */
OrdinalSet<Statement> computeResult(Statement s,Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<? extends ISSABasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExplodedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement){
switch (s.getKind()) {
case NORMAL:
    NormalStatement n=(NormalStatement)s;
  Collection<PointerKey> ref=modRef.getRef(node,h,pa,n.getInstruction(),exclusions);
if (!ref.isEmpty()) {
  ISSABasicBlock bb=cfg.getBlockForInstruction(n.getInstructionIndex());
  BitVectorVariable v=solver.getIn(bb);
  MutableSparseIntSet defs=MutableSparseIntSet.makeEmpty();
  for (  PointerKey p : ref) {
    if (pointerKeyMod.get(p) != null) {
      defs.addAll(pointerKeyMod.get(p).intersection(v.getValue()));
    }
  }
  return new OrdinalSet<Statement>(defs,domain);
}
 else {
  return OrdinalSet.empty();
}
case HEAP_RET_CALLEE:
{
HeapStatement.ReturnCallee r=(HeapStatement.ReturnCallee)s;
PointerKey p=r.getLocation();
BitVectorVariable v=solver.getIn(cfg.exit());
if (pointerKeyMod.get(p) == null) {
  return OrdinalSet.empty();
}
return new OrdinalSet<Statement>(pointerKeyMod.get(p).intersection(v.getValue()),domain);
}
case HEAP_RET_CALLER:
{
HeapStatement.ReturnCaller r=(HeapStatement.ReturnCaller)s;
ISSABasicBlock bb=cfg.getBlockForInstruction(r.getCallIndex());
BitVectorVariable v=solver.getIn(bb);
if (allCalleesMod(cg,r,mod) || pointerKeyMod.get(r.getLocation()) == null || v.getValue() == null) {
return OrdinalSet.empty();
}
 else {
return new OrdinalSet<Statement>(pointerKeyMod.get(r.getLocation()).intersection(v.getValue()),domain);
}
}
case HEAP_PARAM_CALLER:
{
HeapStatement.ParamCaller r=(HeapStatement.ParamCaller)s;
NormalStatement call=ssaInstructionIndex2Statement.get(r.getCallIndex());
ISSABasicBlock callBlock=cfg.getBlockForInstruction(call.getInstructionIndex());
BitVectorVariable v=solver.getIn(callBlock);
if (pointerKeyMod.get(r.getLocation()) == null || v.getValue() == null) {
return OrdinalSet.empty();
}
 else {
return new OrdinalSet<Statement>(pointerKeyMod.get(r.getLocation()).intersection(v.getValue()),domain);
}
}
case NORMAL_RET_CALLEE:
case NORMAL_RET_CALLER:
case PARAM_CALLEE:
case PARAM_CALLER:
case EXC_RET_CALLEE:
case EXC_RET_CALLER:
case PHI:
case PI:
case CATCH:
case METHOD_ENTRY:
return OrdinalSet.empty();
case HEAP_PARAM_CALLEE:
return OrdinalSet.empty();
default :
Assertions.UNREACHABLE(s.getKind().toString());
return null;
}
}

Fixed version (ground truth):
/** 
 * For a statement s, compute the set of statements that may def the heap value read by s.
 */
OrdinalSet<Statement> computeResult(Statement s,Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<? extends ISSABasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExplodedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement){
}
Program: 100199
Project: 100199
Buggy source:
/** 
 * Walk through the instructions and compute basic block boundaries.
 */
private void makeBasicBlocks(){
  SSAInstruction[] instructions=(SSAInstruction[])getInstructions();
  final boolean[] r=new boolean[instructions.length];
  r[0]=true;
  BranchVisitor branchVisitor=makeBranchVisitor(r);
  PEIVisitor peiVisitor=makePEIVisitor(r);
  for (int i=0; i < instructions.length; i++) {
    if (instructions[i] != null) {
      branchVisitor.setIndex(i);
      instructions[i].visit(branchVisitor);
      peiVisitor.setIndex(i);
      instructions[i].visit(peiVisitor);
    }
  }
  BasicBlock b=null;
  for (int i=0; i < r.length; i++) {
    if (r[i]) {
      b=new BasicBlock(i);
      addNode(b);
      if (DEBUG) {
        Trace.println("String_Node_Str" + b);
      }
    }
    i2block[i]=b;
  }
  BasicBlock exit=new BasicBlock(-1);
  if (DEBUG) {
    Trace.println("String_Node_Str" + exit);
  }
  addNode(exit);
}

Fixed version (ground truth):
/** 
 * Walk through the instructions and compute basic block boundaries.
 */
private void makeBasicBlocks(){
  BasicBlock entry=new BasicBlock(-1,-2);
  addNode(entry);
  this.entry=entry;
  SSAInstruction[] instructions=(SSAInstruction[])getInstructions();
  if (instructions.length > 0) {
    final boolean[] r=new boolean[instructions.length];
    r[0]=true;
    BranchVisitor branchVisitor=makeBranchVisitor(r);
    PEIVisitor peiVisitor=makePEIVisitor(r);
    for (int i=0; i < instructions.length; i++) {
      if (instructions[i] != null) {
        branchVisitor.setIndex(i);
        instructions[i].visit(branchVisitor);
        peiVisitor.setIndex(i);
        instructions[i].visit(peiVisitor);
      }
    }
    BasicBlock b=null;
    for (int i=0; i < r.length; i++) {
      if (r[i]) {
        int end=instructions.length - 1;
        for (int j=i; j < instructions.length; j++) {
          if (r[j]) {
            end=j;
            break;
          }
        }
        b=new BasicBlock(i,end);
        addNode(b);
      }
      i2block[i]=b;
    }
  }
  BasicBlock exit=new BasicBlock(-3,-4);
  addNode(exit);
  this.exit=exit;
}
Program: 100200
Project: 100200
Buggy source:
BasicBlock(int start){
  this.start=start;
}

Fixed version (ground truth):
BasicBlock(int start,int end){
  this.start=start;
  this.end=end;
}
Program: 100201
Project: 100201
Buggy source:
/** 
 * TODO: we do not yet support induced CFGS with exception handlers.
 * @param instructions
 * @throws IllegalArgumentException  if instructions is null
 */
public InducedCFG(SSAInstruction[] instructions,IMethod method,Context context){
  super(method);
  if (instructions == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.context=context;
  this.instructions=instructions;
  if (DEBUG) {
    Trace.println("String_Node_Str" + method);
  }
  i2block=new BasicBlock[instructions.length];
  if (instructions.length == 0) {
    makeEmptyBlocks();
  }
 else {
    makeBasicBlocks();
  }
  init();
  computeEdges();
  if (DEBUG) {
    try {
      GraphIntegrity.check(this);
    }
 catch (    UnsoundGraphException e) {
      e.printStackTrace();
      Assertions.UNREACHABLE();
    }
  }
}

Fixed version (ground truth):
/** 
 * TODO: we do not yet support induced CFGS with exception handlers.
 * @param instructions
 * @throws IllegalArgumentException if instructions is null
 */
public InducedCFG(SSAInstruction[] instructions,IMethod method,Context context){
  super(method);
  if (instructions == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.context=context;
  this.instructions=instructions;
  i2block=new BasicBlock[instructions.length];
  makeBasicBlocks();
  init();
  computeEdges();
  if (DEBUG) {
    try {
      GraphIntegrity.check(this);
    }
 catch (    UnsoundGraphException e) {
      e.printStackTrace();
      Assertions.UNREACHABLE();
    }
  }
}
Program: 100202
Project: 100202
Buggy source:
public boolean isEntryBlock(){
  return getNumber() == 0;
}

Fixed version (ground truth):
public boolean isEntryBlock(){
  return this.equals(entry);
}
Program: 100203
Project: 100203
Buggy source:
/** 
 * Method getLastInstructionIndex.
 * @return int
 */
public int getLastInstructionIndex(){
  int exitNumber=InducedCFG.this.getNumber(exit());
  if (getGraphNodeId() == exitNumber) {
    return -2;
  }
  if (getGraphNodeId() == (exitNumber - 1)) {
    return getInstructions().length - 1;
  }
 else {
    BasicBlock next=getNode(getGraphNodeId() + 1);
    return next.getFirstInstructionIndex() - 1;
  }
}

Fixed version (ground truth):
public int getLastInstructionIndex(){
  return end;
}
Program: 100204
Project: 100204
Buggy source:
public boolean isExitBlock(){
  return getLastInstructionIndex() == -2;
}

Fixed version (ground truth):
public boolean isExitBlock(){
  return this.equals(exit);
}
Program: 100205
Project: 100205
Buggy source:
/** 
 * Compute outgoing edges in the control flow graph.
 */
private void computeEdges(){
  for (Iterator it=iterator(); it.hasNext(); ) {
    BasicBlock b=(BasicBlock)it.next();
    if (b.equals(exit()))     continue;
    b.computeOutgoingEdges();
  }
}

Fixed version (ground truth):
/** 
 * Compute outgoing edges in the control flow graph.
 */
private void computeEdges(){
  for (Iterator it=iterator(); it.hasNext(); ) {
    BasicBlock b=(BasicBlock)it.next();
    if (b.equals(exit()))     continue;
    if (b.equals(entry())) {
      addNormalEdge(b,getNode(b.getGraphNodeId() + 1));
      continue;
    }
    SSAInstruction last=(SSAInstruction)getInstructions()[b.getLastInstructionIndex()];
    if (last.isPEI()) {
      addExceptionalEdge(b,exit());
    }
    if (true) {
      if (DEBUG) {
        Trace.println("String_Node_Str" + getNode(b.getGraphNodeId() + 1));
      }
      addNormalEdge(b,getNode(b.getGraphNodeId() + 1));
    }
    if (last instanceof SSAReturnInstruction) {
      BasicBlock exit=exit();
      addNormalEdge(b,exit);
    }
  }
}