nus-yam/ex-repair huggingface dataset:
Program: 40580
Project: 40580
Buggy source:
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 */
private void addParamPassingStatements(int callIndex,Map<CGNode,OrdinalSet<PointerKey>> ref){
  SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)node.getIR().getInstructions()[callIndex];
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamCaller(node,callIndex,call.getUse(j));
    delegate.addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new NormalReturnCaller(node,callIndex);
    delegate.addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ExceptionalReturnCaller(node,callIndex);
      delegate.addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(cg,node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.HeapParamCaller(node,callIndex,p);
      delegate.addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(cg,node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.HeapReturnCaller(node,callIndex,p);
      delegate.addNode(st);
      rets.add(st);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 */
private void addParamPassingStatements(int callIndex,Map<CGNode,OrdinalSet<PointerKey>> ref,IR ir){
  SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)ir.getInstructions()[callIndex];
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamCaller(node,callIndex,call.getUse(j));
    delegate.addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new NormalReturnCaller(node,callIndex);
    delegate.addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ExceptionalReturnCaller(node,callIndex);
      delegate.addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(cg,node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.HeapParamCaller(node,callIndex,p);
      delegate.addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(cg,node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.HeapReturnCaller(node,callIndex,p);
      delegate.addNode(st);
      rets.add(st);
    }
  }
}
Program: 40581
Project: 40581
Buggy source:
/** 
 * Create all data dependence edges in this PDG. Scalar dependences are taken from SSA def-use information. Heap dependences are computed by a reaching defs analysis.
 * @param pa
 * @param mod
 */
private void createScalarDataDependenceEdges(){
}

Fixed version (ground truth):
/** 
 * Create all data dependence edges in this PDG. Scalar dependences are taken from SSA def-use information. Heap dependences are computed by a reaching defs analysis.
 * @param pa
 * @param mod
 */
private void createScalarDataDependenceEdges(IR ir,Map<SSAInstruction,Integer> instructionIndices){
}
Program: 40582
Project: 40582
Buggy source:
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 */
private Collection<SSAInstruction> createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<SSAInstruction> visited=HashSetFactory.make();
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      delegate.addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref);
    }
  }
  return visited;
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 */
private Collection<SSAInstruction> createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<SSAInstruction> visited=HashSetFactory.make();
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      delegate.addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref,ir);
    }
  }
  return visited;
}
Program: 40583
Project: 40583
Buggy source:
/** 
 * Create all nodes in this PDG. Each node is a Statement.
 * @param dOptions
 */
private void createNodes(Map<CGNode,OrdinalSet<PointerKey>> ref,ControlDependenceOptions cOptions){
  IR ir=node.getIR();
  if (ir != null) {
    Collection<SSAInstruction> visited=createNormalStatements(ir,ref);
    createSpecialStatements(ir,visited);
  }
  createCalleeParams(ref);
  createReturnStatements();
  delegate.addNode(new MethodEntryStatement(node));
  delegate.addNode(new MethodExitStatement(node));
}

Fixed version (ground truth):
/** 
 * Create all nodes in this PDG. Each node is a Statement.
 */
private void createNodes(Map<CGNode,OrdinalSet<PointerKey>> ref,ControlDependenceOptions cOptions,IR ir){
  if (ir != null) {
    Collection<SSAInstruction> visited=createNormalStatements(ir,ref);
    createSpecialStatements(ir,visited);
  }
  createCalleeParams(ref);
  createReturnStatements();
  delegate.addNode(new MethodEntryStatement(node));
  delegate.addNode(new MethodExitStatement(node));
}
Program: 40584
Project: 40584
Buggy source:
private void createScalarEdges(ControlDependenceOptions cOptions){
  createScalarDataDependenceEdges();
  createControlDependenceEdges(cOptions);
}

Fixed version (ground truth):
private void createScalarEdges(ControlDependenceOptions cOptions,IR ir,Map<SSAInstruction,Integer> instructionIndices){
  createScalarDataDependenceEdges(ir,instructionIndices);
  createControlDependenceEdges(cOptions,ir,instructionIndices);
}
Program: 40585
Project: 40585
Buggy source:
public static synchronized Statement ssaInstruction2Statement(CGNode node,SSAInstruction s,Map<SSAInstruction,Integer> instructionIndices){
}

Fixed version (ground truth):
public static synchronized Statement ssaInstruction2Statement(CGNode node,SSAInstruction s,Map<SSAInstruction,Integer> instructionIndices,IR ir){
}
Program: 40586
Project: 40586
Buggy source:
/** 
 * Create all control dependence edges in this PDG.
 */
private void createControlDependenceEdges(ControlDependenceOptions cOptions){
}

Fixed version (ground truth):
/** 
 * Create all control dependence edges in this PDG.
 */
private void createControlDependenceEdges(ControlDependenceOptions cOptions,IR ir,Map<SSAInstruction,Integer> instructionIndices){
}
Program: 40587
Project: 40587
Buggy source:
private void populate(){
  if (!isPopulated) {
    isPopulated=true;
    instructionIndices=computeInstructionIndices(node.getIR());
    createNodes(ref,cOptions);
    createScalarEdges(cOptions);
  }
}

Fixed version (ground truth):
/** 
 * WARNING: Since we're using a   {@link HashMap} of {@link SSAInstruction}s, and equals() of   {@link SSAInstruction}assumes a canonical representative for each instruction, we <bf>must</bf> ensure that we use the same IR object throughout initialization!!
 */
private void populate(){
  if (!isPopulated) {
    IR ir=node.getIR();
    isPopulated=true;
    Map<SSAInstruction,Integer> instructionIndices=computeInstructionIndices(ir);
    createNodes(ref,cOptions,ir);
    createScalarEdges(cOptions,ir,instructionIndices);
  }
}
Program: 40590
Project: 40590
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,dstToSrcLabel.bar());
  }
  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){
  if (DEBUG) {
  }
  for (  PointerKeyAndState srcToHandle : matchingPToQueried(dst,src.getPointerKey(),dstToSrcLabel)) {
    handleCopy(srcToHandle,dst,dstToSrcLabel.bar());
  }
  for (  PointerKeyAndState dstToHandle : matchingTrackedQueried(src,dst.getPointerKey(),dstToSrcLabel)) {
    IntSet trackedSet=find(pkToTrackedSet,dstToHandle);
    if (!trackedSet.isEmpty()) {
      if (findOrCreate(pkToTrackedSet,src).addAll(trackedSet)) {
        addToTrackedPToWorklist(src);
      }
    }
  }
}
Program: 40592
Project: 40592
Buggy source:
/** 
 * @return the points-to set of <code>pk</code>, or <code>null</code> ifthe points-to set can't be computed in the allocated budget
 */
public Collection<InstanceKey> getPointsTo(PointerKey pk){
  return getPointsTo(pk,Predicate.<Collection<InstanceKey>>falsePred()).snd;
}

Fixed version (ground truth):
/** 
 * @return the points-to set of <code>pk</code>, or <code>null</code> if the points-to set can't be computed inthe allocated budget
 */
public Collection<InstanceKey> getPointsTo(PointerKey pk){
  return getPointsTo(pk,Predicate.<Collection<InstanceKey>>falsePred()).snd;
}
Program: 40593
Project: 40593
Buggy source:
private void propagateToCallee(){
  if (caller.getIR() == null) {
    return;
  }
  g.addSubgraphForNode(caller);
  SSAAbstractInvokeInstruction[] callInstrs=ir.getCalls(call);
  for (int i=0; i < callInstrs.length; i++) {
    SSAAbstractInvokeInstruction callInstr=callInstrs[i];
    PointerKey actualPk=heapModel.getPointerKeyForLocal(caller,callInstr.getUse(paramPos));
    if (Assertions.verifyAssertions) {
      Assertions._assert(g.containsNode(actualPk));
      Assertions._assert(g.containsNode(localPk));
    }
    handler.handle(curPkAndState,actualPk,paramLabel);
  }
}

Fixed version (ground truth):
private void propagateToCallee(){
  g.addSubgraphForNode(caller);
  SSAAbstractInvokeInstruction[] callInstrs=ir.getCalls(call);
  for (int i=0; i < callInstrs.length; i++) {
    SSAAbstractInvokeInstruction callInstr=callInstrs[i];
    PointerKey actualPk=heapModel.getPointerKeyForLocal(caller,callInstr.getUse(paramPos));
    if (Assertions.verifyAssertions) {
      Assertions._assert(g.containsNode(actualPk));
      Assertions._assert(g.containsNode(localPk));
    }
    handler.handle(curPkAndState,actualPk,paramLabel);
  }
}
Program: 40594
Project: 40594
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: 40595
Project: 40595
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: 40596
Project: 40596
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: 40599
Project: 40599
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: 40602
Project: 40602
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: 40603
Project: 40603
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: 40605
Project: 40605
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: 40606
Project: 40606
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: 40607
Project: 40607
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: 40608
Project: 40608
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: 40610
Project: 40610
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: 40611
Project: 40611
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: 40612
Project: 40612
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: 40613
Project: 40613
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: 40614
Project: 40614
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: 40615
Project: 40615
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: 40616
Project: 40616
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: 40617
Project: 40617
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: 40618
Project: 40618
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: 40619
Project: 40619
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: 40620
Project: 40620
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: 40621
Project: 40621
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: 40622
Project: 40622
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: 40623
Project: 40623
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: 40624
Project: 40624
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: 40625
Project: 40625
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: 40626
Project: 40626
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: 40628
Project: 40628
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: 40629
Project: 40629
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: 40632
Project: 40632
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: 40633
Project: 40633
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: 40634
Project: 40634
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: 40635
Project: 40635
Buggy source:
BasicBlock(int start){
  this.start=start;
}

Fixed version (ground truth):
BasicBlock(int start,int end){
  this.start=start;
  this.end=end;
}
Program: 40636
Project: 40636
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: 40637
Project: 40637
Buggy source:
public boolean isEntryBlock(){
  return getNumber() == 0;
}

Fixed version (ground truth):
public boolean isEntryBlock(){
  return this.equals(entry);
}
Program: 40638
Project: 40638
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: 40639
Project: 40639
Buggy source:
public boolean isExitBlock(){
  return getLastInstructionIndex() == -2;
}

Fixed version (ground truth):
public boolean isExitBlock(){
  return this.equals(exit);
}