nus-yam/ex-repair huggingface dataset:
Program: 132827
Project: 132827
Buggy source:
private Pair<List<Arg>,List<Arg>> removeOldInserts(Block block,Var arr){
  List<Arg> keys=new ArrayList<Arg>();
  List<Arg> vals=new ArrayList<Arg>();
  ListIterator<Statement> it=block.statementIterator();
  while (it.hasNext()) {
    Statement stmt=it.next();
    if (stmt.type() == StatementType.INSTRUCTION) {
      Instruction inst=stmt.instruction();
      if (inst.op == Opcode.ARR_STORE) {
        if (inst.getOutput(0).equals(arr)) {
          it.remove();
          Arg key=inst.getInput(0);
          Arg val=inst.getInput(1);
          assert(Types.isArrayKeyVal(arr,key));
          assert(Types.isElemType(arr,val.getVar()));
          keys.add(key);
          vals.add(val);
        }
      }
    }
  }
  return Pair.create(keys,vals);
}

Fixed version (ground truth):
private Pair<List<Arg>,List<Arg>> removeOldInserts(Block block,Var arr){
  List<Arg> keys=new ArrayList<Arg>();
  List<Arg> vals=new ArrayList<Arg>();
  ListIterator<Statement> it=block.statementIterator();
  while (it.hasNext()) {
    Statement stmt=it.next();
    if (stmt.type() == StatementType.INSTRUCTION) {
      Instruction inst=stmt.instruction();
      if (inst.op == Opcode.ARR_STORE) {
        if (inst.getOutput(0).equals(arr)) {
          it.remove();
          Arg key=inst.getInput(0);
          Arg val=inst.getInput(1);
          assert(Types.isArrayKeyVal(arr,key));
          assert(Types.isElemValType(arr,val));
          keys.add(key);
          vals.add(val);
        }
      }
    }
  }
  return Pair.create(keys,vals);
}
Program: 132829
Project: 132829
Buggy source:
/** 
 * Make a standard computed value for array contents
 * @param arr
 * @param ix
 * @param contents
 * @param refResult if contents is ref
 * @return
 */
public static ValLoc makeArrayResult(Var arr,Arg ix,Var contents,boolean refResult,IsAssign isAssign){
}

Fixed version (ground truth):
/** 
 * Make a standard computed value for array contents
 * @param arr
 * @param ix
 * @param contents
 * @param refResult if contents is ref
 * @return
 */
public static ValLoc makeArrayResult(Var arr,Arg ix,Arg contents,boolean refResult,IsAssign isAssign){
}
Program: 132830
Project: 132830
Buggy source:
public static Instruction arrayStore(Var array,Arg ix,Arg member){
  assert(Types.isArray(array));
  assert(Types.isArrayKeyVal(array,ix));
  assert(Types.isElemType(array,member));
  return new TurbineOp(Opcode.ARR_STORE,array,ix,member);
}

Fixed version (ground truth):
public static Instruction arrayStore(Var array,Arg ix,Arg member){
}
Program: 132831
Project: 132831
Buggy source:
public static Instruction arrayStoreFuture(Var array,Var ix,Arg member){
  return new TurbineOp(Opcode.ARR_STORE_FUTURE,array,ix.asArg(),member);
}

Fixed version (ground truth):
public static Instruction arrayStoreFuture(Var array,Var ix,Arg member){
  assert(Types.isArray(array));
  assert(Types.isArrayKeyFuture(array,ix));
  assert(Types.isElemValType(array,member));
  return new TurbineOp(Opcode.ARR_STORE_FUTURE,array,ix.asArg(),member);
}
Program: 132832
Project: 132832
Buggy source:
public static Instruction arrayRefStoreImm(Var outerArray,Var array,Arg ix,Arg member){
  return new TurbineOp(Opcode.AREF_STORE_IMM,Arrays.asList(outerArray,array),ix,member);
}

Fixed version (ground truth):
public static Instruction arrayRefStoreImm(Var outerArray,Var array,Arg ix,Arg member){
  assert(Types.isArrayRef(array));
  assert(Types.isArrayKeyVal(array,ix));
  assert(Types.isElemValType(array,member));
  return new TurbineOp(Opcode.AREF_STORE_IMM,Arrays.asList(outerArray,array),ix,member);
}
Program: 132833
Project: 132833
Buggy source:
public static Instruction arrayRefStoreFuture(Var outerArray,Var array,Var ix,Arg member){
  return new TurbineOp(Opcode.AREF_STORE_FUTURE,Arrays.asList(outerArray,array),ix.asArg(),member);
}

Fixed version (ground truth):
public static Instruction arrayRefStoreFuture(Var outerArray,Var array,Var ix,Arg member){
  assert(Types.isArrayRef(array));
  assert(Types.isArrayKeyFuture(array,ix));
  assert(Types.isElemValType(array,member));
  return new TurbineOp(Opcode.AREF_STORE_FUTURE,Arrays.asList(outerArray,array),ix.asArg(),member);
}
Program: 132837
Project: 132837
Buggy source:
public Set<Var> getRecursivelyClosed(int stmtIndex){
  return new ClosedSet(stmtIndex,false);
}

Fixed version (ground truth):
public Set<Var> getRecursivelyClosed(int stmtIndex){
  return new ClosedSet(stmtIndex,true);
}
Program: 132838
Project: 132838
Buggy source:
public static SetVariable structRefGet(String target,Value variable){
  return fileRefDecrGet(target,variable,LiteralInt.ZERO);
}

Fixed version (ground truth):
public static SetVariable structRefGet(String target,Value variable){
  return structRefDecrGet(target,variable,LiteralInt.ZERO);
}
Program: 132840
Project: 132840
Buggy source:
private void removeCandidate(Var var,RCTracker tracker,Set<AliasKey> keySet,Set<Var> varSet){
  if (keySet != null) {
    keySet.remove(tracker.getCountKey(var));
  }
  if (varSet != null) {
    varSet.remove(var);
  }
}

Fixed version (ground truth):
private void removeCandidate(Var var,RCTracker tracker,Set<AliasKey> keySet,Set<Var> varSet){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + var.name());
  }
  if (keySet != null) {
    keySet.remove(tracker.getCountKey(var));
  }
  if (varSet != null) {
    varSet.remove(var);
  }
}
Program: 132841
Project: 132841
Buggy source:
/** 
 * Update increments for variables passed into continuation
 * @param cont
 * @param increments
 */
private void updateIncrementsPassIntoCont(Continuation cont,RCTracker increments){
  if (cont.spawnsSingleTask()) {
    long incr=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(keepOpen));
      increments.writeIncr(keepOpen,incr);
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getAllPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      increments.readIncr(v,incr);
    }
  }
 else   if (RCUtil.isForeachLoop(cont)) {
    AbstractForeachLoop foreach=(AbstractForeachLoop)cont;
    updateIncrementsPassIntoForeach(increments,foreach);
  }
}

Fixed version (ground truth):
/** 
 * Update increments for variables passed into continuation
 * @param cont
 * @param increments
 */
private void updateIncrementsPassIntoCont(Continuation cont,RCTracker increments){
  if (cont.spawnsSingleTask()) {
    long incr=1;
    Set<Var> alreadyAdded=new HashSet<Var>();
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(keepOpen));
      alreadyAdded.add(keepOpen);
      increments.writeIncr(keepOpen,incr);
    }
    for (    PassedVar passedIn : cont.getAllPassedVars()) {
      logger.trace(cont.getType() + "String_Node_Str" + passedIn.var.name());
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        increments.readIncr(passedIn.var,incr);
        alreadyAdded.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var) && !alreadyAdded.contains(blockingVar.var)) {
        increments.readIncr(blockingVar.var,incr);
      }
    }
  }
 else   if (RCUtil.isForeachLoop(cont)) {
    AbstractForeachLoop foreach=(AbstractForeachLoop)cont;
    updateIncrementsPassIntoForeach(increments,foreach);
  }
}
Program: 132842
Project: 132842
Buggy source:
private void removePullupIncrements(Block block,RCTracker toRemove){
  ListIterator<Statement> it=block.statementIterator();
  while (it.hasNext()) {
    Statement stmt=it.next();
switch (stmt.type()) {
case INSTRUCTION:
{
        Instruction inst=stmt.instruction();
        if (RefCountOp.isIncrement(inst.op)) {
          Var v=RefCountOp.getRCTarget(inst);
          Arg amountArg=RefCountOp.getRCAmount(inst);
          RefCountType rcType=RefCountOp.getRCType(inst.op);
          if (amountArg.isIntVal()) {
            long amount=amountArg.getIntLit();
            long toRemoveAmount=toRemove.getCount(rcType,v,RCDir.INCR);
            assert(toRemoveAmount <= amount && toRemoveAmount >= 0);
            if (toRemoveAmount > 0) {
              it.remove();
              if (toRemoveAmount < amount) {
                Arg newAmount=Arg.createIntLit(amount - toRemoveAmount);
                it.add(RefCountOp.incrRef(rcType,v,newAmount));
              }
            }
          }
        }
        break;
      }
case CONDITIONAL:
    break;
default :
  throw new STCRuntimeError("String_Node_Str" + stmt.type());
}
}
}

Fixed version (ground truth):
private void removePullupIncrements(Block block,RCTracker toRemove){
  ListIterator<Statement> it=block.statementIterator();
  while (it.hasNext()) {
    Statement stmt=it.next();
switch (stmt.type()) {
case INSTRUCTION:
{
        Instruction inst=stmt.instruction();
        if (RefCountOp.isIncrement(inst.op)) {
          Var v=RefCountOp.getRCTarget(inst);
          Arg amountArg=RefCountOp.getRCAmount(inst);
          RefCountType rcType=RefCountOp.getRCType(inst.op);
          if (amountArg.isIntVal()) {
            long amount=amountArg.getIntLit();
            long toRemoveAmount=toRemove.getCount(rcType,v,RCDir.INCR);
            assert(toRemoveAmount <= amount && toRemoveAmount >= 0);
            if (toRemoveAmount > 0) {
              logger.trace("String_Node_Str" + v.name() + "String_Node_Str"+ rcType+ "String_Node_Str"+ toRemoveAmount);
              it.remove();
              if (toRemoveAmount < amount) {
                Arg newAmount=Arg.createIntLit(amount - toRemoveAmount);
                it.add(RefCountOp.incrRef(rcType,v,newAmount));
              }
            }
          }
        }
        break;
      }
case CONDITIONAL:
    break;
default :
  throw new STCRuntimeError("String_Node_Str" + stmt.type());
}
}
}
Program: 132843
Project: 132843
Buggy source:
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
  }
  Set<Var> readIncrTmp=new HashSet<Var>();
  for (  PassedVar passedIn : cont.getAllPassedVars()) {
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      readIncrTmp.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var)) {
      readIncrTmp.add(blockingVar.var);
    }
  }
  for (  Var v : readIncrTmp) {
    increments.readDecr(v,amount);
  }
}

Fixed version (ground truth):
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  Set<Var> alreadyAdded=new HashSet<Var>();
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
    alreadyAdded.add(keepOpen);
  }
  for (  PassedVar passedIn : cont.getAllPassedVars()) {
    logger.trace(cont.getType() + "String_Node_Str" + passedIn.var.name());
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      increments.readDecr(passedIn.var,amount);
      alreadyAdded.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var) && !alreadyAdded.contains(blockingVar.var)) {
      increments.readDecr(blockingVar.var,amount);
    }
  }
}
Program: 132844
Project: 132844
Buggy source:
private void removePullupDecrements(Block block,RCTracker toRemove){
  ListIterator<CleanupAction> it=block.cleanupIterator();
  while (it.hasNext()) {
    CleanupAction ca=it.next();
    Instruction inst=ca.action();
    if (RefCountOp.isDecrement(inst.op)) {
      Var v=RefCountOp.getRCTarget(inst);
      Arg amountArg=RefCountOp.getRCAmount(inst);
      RefCountType rcType=RefCountOp.getRCType(inst.op);
      if (amountArg.isIntVal()) {
        long amount=amountArg.getIntLit();
        long toRemoveAmount=-1 * toRemove.getCount(rcType,v,RCDir.DECR);
        assert(toRemoveAmount >= 0 && toRemoveAmount <= amount);
        if (toRemoveAmount > 0) {
          it.remove();
          if (toRemoveAmount < amount) {
            Arg newAmount=Arg.createIntLit(amount - toRemoveAmount);
            Instruction newDecr=RefCountOp.decrRef(rcType,v,newAmount);
            it.add(new CleanupAction(ca.var(),newDecr));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void removePullupDecrements(Block block,RCTracker toRemove){
  ListIterator<CleanupAction> it=block.cleanupIterator();
  while (it.hasNext()) {
    CleanupAction ca=it.next();
    Instruction inst=ca.action();
    if (RefCountOp.isDecrement(inst.op)) {
      Var v=RefCountOp.getRCTarget(inst);
      Arg amountArg=RefCountOp.getRCAmount(inst);
      RefCountType rcType=RefCountOp.getRCType(inst.op);
      if (amountArg.isIntVal()) {
        long amount=amountArg.getIntLit();
        long toRemoveAmount=-1 * toRemove.getCount(rcType,v,RCDir.DECR);
        logger.trace("String_Node_Str" + v.name() + "String_Node_Str"+ rcType+ "String_Node_Str"+ toRemoveAmount);
        assert(toRemoveAmount >= 0 && toRemoveAmount <= amount);
        if (toRemoveAmount > 0) {
          it.remove();
          if (toRemoveAmount < amount) {
            Arg newAmount=Arg.createIntLit(amount - toRemoveAmount);
            Instruction newDecr=RefCountOp.decrRef(rcType,v,newAmount);
            it.add(new CleanupAction(ca.var(),newDecr));
          }
        }
      }
    }
  }
}
Program: 132845
Project: 132845
Buggy source:
/** 
 * Try to piggyback constant incrs/decrs from outside continuation.
 * @param increments
 * @param type
 * @param decrement if true, try to piggyback decrements, if false, increments
 * @return list of vars for which increments were piggybacked
 */
public List<Var> tryPiggyBack(Counters<Var> increments,RefCountType type,boolean decrement){
  List<Var> result=new ArrayList<Var>();
  for (  RefCount startIncr : startIncrements) {
    if (startIncr.type == type) {
      long incr=increments.getCount(startIncr.var);
      if ((decrement && incr < 0) || (!decrement && incr > 0)) {
        addConstantStartIncrement(startIncr.var,type,Arg.createIntLit(incr));
        result.add(startIncr.var);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Try to piggyback constant incrs/decrs from outside continuation.
 * @param increments
 * @param type
 * @param dir whether to piggyback decrements or increments
 * @return list of vars for which increments were piggybacked
 */
public List<Var> tryPiggyBack(Counters<Var> increments,RefCountType type,RCDir dir){
  List<Var> result=new ArrayList<Var>();
  for (  RefCount startIncr : startIncrements) {
    if (startIncr.type == type) {
      long incr=increments.getCount(startIncr.var);
      if ((dir == RCDir.DECR && incr < 0) || (dir == RCDir.INCR && incr > 0)) {
        addConstantStartIncrement(startIncr.var,type,Arg.createIntLit(incr));
        result.add(startIncr.var);
      }
    }
  }
  return result;
}
Program: 132846
Project: 132846
Buggy source:
/** 
 * Insert all reference increments and decrements in place
 * @param stmtIt
 * @param increments
 */
public void dumpIncrements(Instruction inst,Block block,ListIterator<Statement> stmtIt,RCTracker increments){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    for (    Entry<AliasKey,Long> e : increments.rcIter(rcType,RCDir.INCR)) {
      Var var=increments.getRefCountVar(block,e.getKey(),true);
      Long incr=e.getValue();
      assert(incr >= 0);
      if (incr > 0) {
        boolean varInit=inst.isInitialized(var);
        if (inst != null && !(var.storage() == Alloc.ALIAS && varInit)) {
          insertIncrBefore(block,stmtIt,var,incr,rcType);
        }
 else {
          insertIncrAfter(block,stmtIt,var,incr,rcType);
        }
      }
 else       if (incr < 0) {
        insertDecrAfter(block,stmtIt,var,incr * -1,rcType);
      }
    }
  }
  increments.resetAll();
}

Fixed version (ground truth):
/** 
 * Insert all reference increments and decrements in place
 * @param stmt the statement to insert before or afternull indicates end of the block
 * @param stmtIt
 * @param increments
 */
public void dumpIncrements(Statement stmt,Block block,ListIterator<Statement> stmtIt,RCTracker increments){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    for (    Entry<AliasKey,Long> e : increments.rcIter(rcType,RCDir.INCR)) {
      Var var=increments.getRefCountVar(block,e.getKey(),true);
      assert(var != null);
      Long incr=e.getValue();
      assert(incr >= 0);
      if (incr > 0) {
        boolean varInit=stmt != null && stmt.type() == StatementType.INSTRUCTION && stmt.instruction().isInitialized(var);
        if (stmt != null && (stmt.type() == StatementType.INSTRUCTION && !(var.storage() == Alloc.ALIAS && varInit))) {
          insertIncrBefore(block,stmtIt,var,incr,rcType);
        }
 else {
          insertIncrAfter(block,stmtIt,var,incr,rcType);
        }
      }
 else       if (incr < 0) {
        insertDecrAfter(block,stmtIt,var,incr * -1,rcType);
      }
    }
  }
  increments.resetAll(RCDir.INCR);
}
Program: 132847
Project: 132847
Buggy source:
public void dumpDecrements(Block block,RCTracker increments){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    for (    Entry<AliasKey,Long> e : increments.rcIter(rcType,RCDir.DECR)) {
      assert(e.getValue() <= 0);
      Var var=increments.getRefCountVar(block,e.getKey(),true);
      Arg amount=Arg.createIntLit(e.getValue() * -1);
      block.addCleanup(var,RefCountOp.decrRef(rcType,var,amount));
      e.setValue(0L);
    }
  }
}

Fixed version (ground truth):
public void dumpDecrements(Block block,RCTracker increments){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    for (    Entry<AliasKey,Long> e : increments.rcIter(rcType,RCDir.DECR)) {
      assert(e.getValue() <= 0);
      Var var=increments.getRefCountVar(block,e.getKey(),true);
      Arg amount=Arg.createIntLit(e.getValue() * -1);
      block.addCleanup(var,RefCountOp.decrRef(rcType,var,amount));
    }
  }
  increments.resetAll(RCDir.DECR);
}
Program: 132848
Project: 132848
Buggy source:
public void resetAll(){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    for (    RCDir dir : RCDir.values()) {
      getCounters(rcType,dir).resetAll();
    }
  }
}

Fixed version (ground truth):
public void resetAll(RCDir dir){
  for (  RefCountType rcType : RefcountPass.RC_TYPES) {
    getCounters(rcType,dir).resetAll();
  }
}
Program: 132850
Project: 132850
Buggy source:
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  Set<Var> alreadyAdded=new HashSet<Var>();
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
    alreadyAdded.add(keepOpen);
  }
  for (  PassedVar passedIn : cont.getAllPassedVars()) {
    logger.trace(cont.getType() + "String_Node_Str" + passedIn.var.name());
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      increments.readDecr(passedIn.var,amount);
      alreadyAdded.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var) && !alreadyAdded.contains(blockingVar.var)) {
      increments.readDecr(blockingVar.var,amount);
    }
  }
}

Fixed version (ground truth):
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  Set<Var> alreadyAdded=new HashSet<Var>();
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
    alreadyAdded.add(keepOpen);
  }
  for (  PassedVar passedIn : cont.getAllPassedVars()) {
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      increments.readDecr(passedIn.var,amount);
      alreadyAdded.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var) && !alreadyAdded.contains(blockingVar.var)) {
      increments.readDecr(blockingVar.var,amount);
    }
  }
}
Program: 132851
Project: 132851
Buggy source:
/** 
 * Work out how much each variable needs to be incremented. In some cases this will place the increment instructions right away
 * @param block
 * @param increments
 */
private void countBlockIncrements(Block block,RCTracker increments){
  ListIterator<Statement> stmtIt=block.statementIterator();
  while (stmtIt.hasNext()) {
    Statement stmt=stmtIt.next();
    Instruction inst;
switch (stmt.type()) {
case INSTRUCTION:
      inst=stmt.instruction();
    updateCountsInstruction(inst,increments);
  increments.updateForInstruction(inst);
break;
case CONDITIONAL:
inst=null;
updateIncrementsPassIntoCont(stmt.conditional(),increments);
break;
default :
throw new STCRuntimeError("String_Node_Str" + stmt.type());
}
if (!RCUtil.cancelEnabled()) {
placer.dumpIncrements(inst,block,stmtIt,increments);
}
}
for (Continuation cont : block.getContinuations()) {
updateIncrementsPassIntoCont(cont,increments);
if (!RCUtil.cancelEnabled()) {
placer.dumpIncrements(null,block,block.statementEndIterator(),increments);
}
}
}

Fixed version (ground truth):
/** 
 * Work out how much each variable needs to be incremented. In some cases this will place the increment instructions right away
 * @param block
 * @param increments
 */
private void countBlockIncrements(Block block,RCTracker increments){
  ListIterator<Statement> stmtIt=block.statementIterator();
  while (stmtIt.hasNext()) {
    Statement stmt=stmtIt.next();
switch (stmt.type()) {
case INSTRUCTION:
      Instruction inst=stmt.instruction();
    updateCountsInstruction(inst,increments);
  increments.updateForInstruction(inst);
break;
case CONDITIONAL:
updateIncrementsPassIntoCont(stmt.conditional(),increments);
break;
default :
throw new STCRuntimeError("String_Node_Str" + stmt.type());
}
if (!RCUtil.cancelEnabled()) {
placer.dumpIncrements(stmt,block,stmtIt,increments);
}
}
for (Continuation cont : block.getContinuations()) {
updateIncrementsPassIntoCont(cont,increments);
if (!RCUtil.cancelEnabled()) {
placer.dumpIncrements(null,block,block.statementEndIterator(),increments);
}
}
}
Program: 132852
Project: 132852
Buggy source:
public ClosedEntry getClosedEntry(Var var,boolean recursive,int stmtIndex){
  ClosedEntry ce=getDirectClosedEntry(var,recursive,stmtIndex);
  if (ce != null && ce.matches(recursive,stmtIndex)) {
    return ce;
  }
  if (recursive || useTransitiveDeps) {
    return ce;
  }
  Deque<Var> depStack=new ArrayDeque<Var>();
  depStack.addAll(directDeps(var));
  Set<Var> visited=new HashSet<Var>();
  visited.add(var);
  while (!depStack.isEmpty()) {
    Var predecessor=depStack.pop();
    if (!visited.contains(predecessor)) {
      ClosedEntry predCE=getDirectClosedEntry(predecessor,false,stmtIndex);
      if (ce != null) {
        assert(predCE.matches(recursive,stmtIndex));
        closed.put(var,predCE);
        return predCE;
      }
      depStack.addAll(directDeps(predecessor));
    }
  }
  return null;
}

Fixed version (ground truth):
public ClosedEntry getClosedEntry(Var var,boolean recursive,int stmtIndex){
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + var.name() + "String_Node_Str"+ stmtIndex+ "String_Node_Str"+ recursive);
  }
  ClosedEntry ce=getDirectClosedEntry(var,recursive,stmtIndex);
  if (ce != null && ce.matches(recursive,stmtIndex)) {
    return ce;
  }
  if (recursive || useTransitiveDeps) {
    return ce;
  }
  Deque<Var> depStack=new ArrayDeque<Var>();
  depStack.addAll(directDeps(var));
  Set<Var> visited=new HashSet<Var>();
  visited.add(var);
  while (!depStack.isEmpty()) {
    Var predecessor=depStack.pop();
    if (!visited.contains(predecessor)) {
      ClosedEntry predCE=getDirectClosedEntry(predecessor,false,stmtIndex);
      if (predCE != null) {
        assert(predCE.matches(recursive,stmtIndex));
        closed.put(var,predCE);
        return predCE;
      }
      depStack.addAll(directDeps(predecessor));
    }
  }
  return null;
}
Program: 132853
Project: 132853
Buggy source:
/** 
 * Check if variable is directly closed. Returns a matching entry 
 * @param var
 * @param recursive
 * @param stmtIndex
 * @return
 */
private ClosedEntry getDirectClosedEntry(Var var,boolean recursive,int stmtIndex){
  ClosedVarTracker curr=this;
  int currStmtIndex=stmtIndex;
  while (curr != null) {
    for (    ClosedEntry ce : curr.closed.get(var)) {
      logger.trace(var + "String_Node_Str" + ce+ "String_Node_Str"+ recursive+ "String_Node_Str"+ currStmtIndex);
      if (ce.matches(recursive,currStmtIndex)) {
        if (curr == this) {
          return ce;
        }
 else {
          ClosedEntry origScopeEntry=new ClosedEntry(0,ce.recursive);
          closed.put(var,origScopeEntry);
          return origScopeEntry;
        }
      }
    }
    currStmtIndex=curr.parentStmtIndex;
    curr=curr.parent;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Check if variable is directly closed. Returns a matching entry 
 * @param var
 * @param recursive
 * @param stmtIndex
 * @return
 */
private ClosedEntry getDirectClosedEntry(Var var,boolean recursive,int stmtIndex){
  ClosedVarTracker curr=this;
  int currStmtIndex=stmtIndex;
  while (curr != null) {
    for (    ClosedEntry ce : curr.closed.get(var)) {
      logger.trace(var + "String_Node_Str" + ce+ "String_Node_Str"+ recursive+ "String_Node_Str"+ currStmtIndex);
      if (ce.matches(recursive,currStmtIndex)) {
        logger.trace("String_Node_Str");
        if (curr == this) {
          return ce;
        }
 else {
          ClosedEntry origScopeEntry=new ClosedEntry(0,ce.recursive);
          closed.put(var,origScopeEntry);
          return origScopeEntry;
        }
      }
    }
    currStmtIndex=curr.parentStmtIndex;
    curr=curr.parent;
  }
  return null;
}
Program: 132854
Project: 132854
Buggy source:
public boolean matches(boolean recursive,int stmtIndex){
  return this.stmtIndex <= stmtIndex && (!recursive || this.recursive);
}

Fixed version (ground truth):
public boolean matches(boolean recursive,int stmtIndex){
  return this.stmtIndex < stmtIndex && (!recursive || this.recursive);
}
Program: 132855
Project: 132855
Buggy source:
private ClosedVarTracker(Logger logger,boolean useTransitiveDeps,ClosedVarTracker parent,int parentStmtIndex){
  this.logger=logger;
  this.useTransitiveDeps=useTransitiveDeps;
  this.parent=parent;
  this.parentStmtIndex=parentStmtIndex;
  this.closed=new MultiMap<Var,ClosedEntry>();
  this.dependsOn=new MultiMap<Var,Var>();
}

Fixed version (ground truth):
private ClosedVarTracker(Logger logger,boolean useTransitiveDeps,ClosedVarTracker parent,int parentStmtIndex){
  assert(parentStmtIndex >= 0);
  this.logger=logger;
  this.useTransitiveDeps=useTransitiveDeps;
  this.parent=parent;
  this.parentStmtIndex=parentStmtIndex;
  this.closed=new MultiMap<Var,ClosedEntry>();
  this.dependsOn=new MultiMap<Var,Var>();
}
Program: 132856
Project: 132856
Buggy source:
/** 
 * Inline from bottom-up
 * @param mainBlock
 * @param cong
 */
private void inlinePass(GlobalConstants consts,Block block,Map<Block,Congruences> cong){
  Congruences blockState=cong.get(block);
  assert(blockState != null);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + System.identityHashCode(block) + "String_Node_Str"+ block.getType());
    blockState.printTraceInfo(logger,consts);
  }
  int origStmtCount=block.getStatements().size();
  ListIterator<Statement> stmtIt=block.statementIterator();
  while (stmtIt.hasNext()) {
    Statement stmt=stmtIt.next();
    if (stmt.type() == StatementType.CONDITIONAL) {
      tryInlineConditional(consts,block,stmtIt,stmt.conditional(),cong);
    }
 else {
      assert(stmt.type() == StatementType.INSTRUCTION);
    }
  }
  Set<Var> closedVars=blockState.getClosed(origStmtCount);
  Set<Var> recClosedVars=blockState.getRecursivelyClosed(origStmtCount);
  ListIterator<Continuation> contIt=block.continuationIterator();
  while (contIt.hasNext()) {
    Continuation cont=contIt.next();
    inlinePassRecurse(consts,cont,cong);
    if (cont.isNoop()) {
      contIt.remove();
    }
 else     if (tryInlineContinuation(block,cont,contIt,closedVars,recClosedVars)) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Inline from bottom-up
 * @param mainBlock
 * @param cong
 */
private void inlinePass(GlobalConstants consts,Block block,Map<Block,Congruences> cong){
  Congruences blockState=cong.get(block);
  assert(blockState != null);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + System.identityHashCode(block) + "String_Node_Str"+ block.getType());
    blockState.printTraceInfo(logger,consts);
  }
  int origStmtCount=block.getStatements().size();
  ListIterator<Statement> stmtIt=block.statementIterator();
  while (stmtIt.hasNext()) {
    Statement stmt=stmtIt.next();
    if (stmt.type() == StatementType.CONDITIONAL) {
      tryInlineConditional(consts,block,stmtIt,stmt.conditional(),cong);
    }
 else {
      assert(stmt.type() == StatementType.INSTRUCTION);
    }
  }
  Set<Var> closedVars=blockState.getClosed(origStmtCount);
  Set<Var> recClosedVars=blockState.getRecursivelyClosed(origStmtCount);
  ListIterator<Continuation> contIt=block.continuationIterator();
  while (contIt.hasNext()) {
    Continuation cont=contIt.next();
    inlinePassRecurse(consts,cont,cong);
    if (cont.isNoop()) {
      logger.trace("String_Node_Str" + cont.getType());
      contIt.remove();
    }
 else     if (tryInlineContinuation(block,cont,contIt,closedVars,recClosedVars)) {
      logger.trace("String_Node_Str" + cont.getType());
    }
  }
}
Program: 132859
Project: 132859
Buggy source:
private List<TypeName> nestedTypeList(Type type,boolean includeKeyTypes,boolean valueType,boolean includeBaseType){
  List<TypeName> typeList=new ArrayList<TypeName>();
  Type curr=type;
  do {
    TypeName reprType;
    if (valueType) {
      reprType=valRepresentationType(curr);
    }
 else {
      reprType=representationType(curr,false);
    }
    typeList.add(reprType);
    if (includeKeyTypes && Types.isArray(curr)) {
      typeList.add(representationType(Types.arrayKeyType(curr),false));
    }
    curr=Types.containerElemType(curr);
  }
 while (Types.isContainer(curr));
  if (includeBaseType) {
    TypeName reprType;
    if (valueType) {
      reprType=valRepresentationType(curr);
    }
 else {
      reprType=representationType(curr,false);
    }
    typeList.add(reprType);
  }
  return typeList;
}

Fixed version (ground truth):
private List<TypeName> nestedTypeList(Type type,boolean includeKeyTypes,boolean valueType,boolean includeBaseType){
  List<TypeName> typeList=new ArrayList<TypeName>();
  Type curr=type;
  do {
    TypeName reprType;
    if (valueType) {
      reprType=valRepresentationType(curr);
    }
 else {
      reprType=representationType(curr,false);
    }
    typeList.add(reprType);
    if (includeKeyTypes && (Types.isArray(curr) || Types.isArrayLocal(curr))) {
      typeList.add(representationType(Types.arrayKeyType(curr),false));
    }
    curr=Types.containerElemType(curr);
  }
 while (Types.isContainer(curr) || Types.isContainerLocal(curr));
  if (includeBaseType) {
    TypeName reprType;
    if (valueType) {
      reprType=valRepresentationType(curr);
    }
 else {
      reprType=representationType(curr,false);
    }
    typeList.add(reprType);
  }
  return typeList;
}
Program: 132860
Project: 132860
Buggy source:
private void startForeachSplit(String procName,Var arrayVar,String contentsVar,int splitDegree,int leafDegree,boolean haveKeys,List<PassedVar> usedVars,List<RefCount> perIterIncrs,MultiMap<Var,RefCount> constIncrs){
  pointAdd(Turbine.containerSize(TCLTMP_CONTAINER_SIZE,varToExpr(arrayVar)));
  Value containerSize=Value.numericValue(TCLTMP_CONTAINER_SIZE);
  Expression lastIndex=TclExpr.minus(containerSize,LiteralInt.ONE);
  handleForeachContainerRefcounts(perIterIncrs,constIncrs,containerSize);
  ArrayList<PassedVar> splitUsedVars=new ArrayList<PassedVar>(usedVars);
  if (!PassedVar.contains(splitUsedVars,arrayVar)) {
    splitUsedVars.add(new PassedVar(arrayVar,false));
  }
  startRangeSplit(procName,splitUsedVars,perIterIncrs,splitDegree,leafDegree,LiteralInt.ZERO,lastIndex,LiteralInt.ONE);
  pointAdd(new SetVariable(TCLTMP_SPLITLEN,new TclExpr(Value.numericValue(TCLTMP_RANGE_HI),TclExpr.MINUS,Value.numericValue(TCLTMP_RANGE_LO),TclExpr.PLUS,LiteralInt.ONE)));
  pointAdd(Turbine.enumerate(contentsVar,varToExpr(arrayVar),haveKeys,Value.numericValue(TCLTMP_SPLITLEN),TCLTMP_RANGE_LO_V));
}

Fixed version (ground truth):
private void startForeachSplit(String procName,Var arrayVar,String contentsVar,int splitDegree,int leafDegree,boolean haveKeys,List<PassedVar> usedVars,List<RefCount> perIterIncrs,MultiMap<Var,RefCount> constIncrs){
  pointAdd(Turbine.containerSize(TCLTMP_CONTAINER_SIZE,varToExpr(arrayVar)));
  Value containerSize=Value.numericValue(TCLTMP_CONTAINER_SIZE);
  Expression lastIndex=TclExpr.minus(containerSize,LiteralInt.ONE);
  handleForeachContainerRefcounts(perIterIncrs,constIncrs,containerSize);
  ArrayList<PassedVar> splitUsedVars=new ArrayList<PassedVar>(usedVars);
  if (!PassedVar.contains(splitUsedVars,arrayVar)) {
    splitUsedVars.add(new PassedVar(arrayVar,false));
  }
  startRangeSplit(procName,splitUsedVars,perIterIncrs,splitDegree,leafDegree,LiteralInt.ZERO,lastIndex,LiteralInt.ONE);
  pointAdd(new SetVariable(TCLTMP_SPLITLEN,new TclExpr(Value.numericValue(TCLTMP_RANGE_HI),TclExpr.MINUS,Value.numericValue(TCLTMP_RANGE_LO),TclExpr.PLUS,LiteralInt.ONE)));
  pointAdd(Turbine.enumerate(contentsVar,varToExpr(arrayVar),haveKeys,TCLTMP_RANGE_LO_V,Value.numericValue(TCLTMP_SPLITLEN)));
}
Program: 132861
Project: 132861
Buggy source:
/** 
 * Check variable initialization recursively on continuation. This is the workhorse of this module that traverses the intermediate representation and finds out which variables are initialized 
 * @param logger
 * @param fn
 * @param state Initialized vars.  Updated if we discover that more varsare initialized after continuation
 * @param validate if true, validate correct usage of initialized variables.For validation to work, initVars and assignedVals must be updated correctly to reflect initializations that occurred in outer continuations
 * @param c
 */
public static void checkInitCont(Logger logger,InitState state,Continuation c,boolean validate){
  if (validate) {
    for (    Var v : c.requiredVars(false)) {
      state.assertInitialized(c.getType(),v,false);
      state.assertAssigned(c.getType(),v);
    }
  }
  if (validate && c.isAsync()) {
    for (    PassedVar pv : c.getPassedVars()) {
      state.assertInitialized(c.getType(),pv.var,false);
      state.assertAssigned(c.getType(),pv.var);
    }
  }
  if (validate || InitState.canUnifyBranches(c)) {
    recurseOnContinuation(logger,state,c,validate);
  }
}

Fixed version (ground truth):
/** 
 * Check variable initialization recursively on continuation. This is the workhorse of this module that traverses the intermediate representation and finds out which variables are initialized 
 * @param logger
 * @param state Initialized vars.  Updated if we discover that more varsare initialized after continuation
 * @param validate if true, validate correct usage of initialized variables.For validation to work, initVars and assignedVals must be updated correctly to reflect initializations that occurred in outer continuations
 * @param c
 */
public static void checkInitCont(Logger logger,InitState state,Continuation c,boolean validate){
  if (validate) {
    for (    Var v : c.requiredVars(false)) {
      state.assertInitialized(c.getType(),v,false);
      state.assertAssigned(c.getType(),v);
    }
  }
  if (validate && c.isAsync()) {
    for (    PassedVar pv : c.getPassedVars()) {
      state.assertInitialized(c.getType(),pv.var,false);
      state.assertAssigned(c.getType(),pv.var);
    }
  }
  if (validate || InitState.canUnifyBranches(c)) {
    recurseOnContinuation(logger,state,c,validate);
  }
}
Program: 132862
Project: 132862
Buggy source:
/** 
 * Analysis that performs validation of variable initialization within a function. Throws a runtime error if a problem is found.
 * @param logger
 * @param fn
 * @param block
 */
public static void checkVarInit(Logger logger,Function fn){
  recurseOnBlock(logger,fn.mainBlock(),InitState.enterFunction(fn),true);
}

Fixed version (ground truth):
/** 
 * Analysis that performs validation of variable initialization within a function. Throws a runtime error if a problem is found.
 * @param logger
 * @param fn
 */
public static void checkVarInit(Logger logger,Function fn){
  recurseOnBlock(logger,fn.mainBlock(),InitState.enterFunction(fn),true);
}
Program: 132865
Project: 132865
Buggy source:
/** 
 * Update increments for variables passed into continuation
 * @param cont
 * @param increments
 */
private void updateIncrementsPassIntoCont(Continuation cont,RCTracker increments){
  if (cont.spawnsSingleTask()) {
    long incr=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(keepOpen));
      increments.writeIncr(keepOpen,incr);
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getAllPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      increments.readIncr(v,incr);
    }
  }
  if (RCUtil.isForeachLoop(cont)) {
    AbstractForeachLoop foreach=(AbstractForeachLoop)cont;
    updateIncrementsPassIntoForeach(increments,foreach);
  }
}

Fixed version (ground truth):
/** 
 * Update increments for variables passed into continuation
 * @param cont
 * @param increments
 */
private void updateIncrementsPassIntoCont(Continuation cont,RCTracker increments){
  if (cont.spawnsSingleTask()) {
    long incr=1;
    for (    Var keepOpen : cont.getKeepOpenVars()) {
      assert(RefCounting.hasWriteRefCount(keepOpen));
      increments.writeIncr(keepOpen,incr);
    }
    Set<Var> readIncrTmp=new HashSet<Var>();
    for (    PassedVar passedIn : cont.getAllPassedVars()) {
      if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
        readIncrTmp.add(passedIn.var);
        if (cont.getType() == ContinuationType.FOREACH_LOOP) {
          System.err.println(passedIn.var);
        }
      }
    }
    for (    BlockingVar blockingVar : cont.blockingVars(false)) {
      if (RefCounting.hasReadRefCount(blockingVar.var)) {
        readIncrTmp.add(blockingVar.var);
      }
    }
    for (    Var v : readIncrTmp) {
      increments.readIncr(v,incr);
    }
  }
 else   if (RCUtil.isForeachLoop(cont)) {
    AbstractForeachLoop foreach=(AbstractForeachLoop)cont;
    updateIncrementsPassIntoForeach(increments,foreach);
  }
}
Program: 132866
Project: 132866
Buggy source:
public void updateIncrementsPassIntoForeach(RCTracker increments,AbstractForeachLoop foreach){
  for (  RefCount rc : foreach.getStartIncrements()) {
    increments.incr(rc.var,rc.type,1);
    foreach.addConstantStartIncrement(rc.var,rc.type,Arg.createIntLit(-1));
  }
}

Fixed version (ground truth):
private void updateIncrementsPassIntoForeach(RCTracker increments,AbstractForeachLoop foreach){
  if (foreach.isAsync()) {
    for (    RefCount rc : foreach.getStartIncrements()) {
      increments.incr(rc.var,rc.type,1);
      foreach.addConstantStartIncrement(rc.var,rc.type,Arg.createIntLit(-1));
    }
  }
}
Program: 132868
Project: 132868
Buggy source:
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
  }
  Set<Var> readIncrTmp=new HashSet<Var>();
  for (  PassedVar passedIn : cont.getPassedVars()) {
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      readIncrTmp.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var)) {
      readIncrTmp.add(blockingVar.var);
    }
  }
  for (  Var v : readIncrTmp) {
    increments.readDecr(v,amount);
  }
}

Fixed version (ground truth):
private void addDecrementsAsyncCont(Continuation cont,RCTracker increments){
  long amount=1;
  for (  Var keepOpen : cont.getKeepOpenVars()) {
    increments.writeDecr(keepOpen,amount);
  }
  Set<Var> readIncrTmp=new HashSet<Var>();
  for (  PassedVar passedIn : cont.getAllPassedVars()) {
    if (!passedIn.writeOnly && RefCounting.hasReadRefCount(passedIn.var)) {
      readIncrTmp.add(passedIn.var);
    }
  }
  for (  BlockingVar blockingVar : cont.blockingVars(false)) {
    if (RefCounting.hasReadRefCount(blockingVar.var)) {
      readIncrTmp.add(blockingVar.var);
    }
  }
  for (  Var v : readIncrTmp) {
    increments.readDecr(v,amount);
  }
}
Program: 132869
Project: 132869
Buggy source:
private void placeRefcounts(Logger logger,Function fn,Block block,RCTracker increments,Set<Var> parentAssignedAliasVars){
  increments.canonicalize();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + block.getType() + "String_Node_Str"+ fn.getName());
    logger.trace("String_Node_Str");
    logger.trace(increments);
  }
  if (RCUtil.cancelEnabled()) {
    pullUpRefIncrements(block,increments);
  }
  for (  RefCountType rcType : RC_TYPES) {
    placer.placeDecrements(logger,fn,block,increments,rcType);
    placer.placeIncrements(block,increments,rcType,parentAssignedAliasVars);
    RCUtil.checkRCZero(block,increments,rcType,true,true);
  }
}

Fixed version (ground truth):
private void placeRefcounts(Logger logger,Function fn,Block block,RCTracker increments,Set<Var> parentAssignedAliasVars){
  increments.canonicalize();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str");
    logger.trace("String_Node_Str" + block.getType() + "String_Node_Str"+ fn.getName());
    logger.trace("String_Node_Str");
    logger.trace(increments);
  }
  reorderContinuations(logger,block);
  if (RCUtil.cancelEnabled()) {
    pullUpRefIncrements(block,increments);
  }
  for (  RefCountType rcType : RC_TYPES) {
    placer.placeDecrements(logger,fn,block,increments,rcType);
    placer.placeIncrements(block,increments,rcType,parentAssignedAliasVars);
    RCUtil.checkRCZero(block,increments,rcType,true,true);
  }
}
Program: 132870
Project: 132870
Buggy source:
public void markContradiction(Arg arg){
  arg=findCanonical(arg);
  boolean newContradiction=contradictions.add(arg);
  if (!newContradiction) {
    return;
  }
  CongruentSets curr=this;
  do {
    for (    RecCV setMember : curr.canonicalInv.get(arg)) {
      if (setMember.isArg() && !setMember.arg().equals(arg)) {
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + arg + "String_Node_Str"+ setMember);
        }
        contradictions.add(setMember.arg());
      }
    }
    curr=curr.parent;
  }
 while (curr != null);
  curr=this;
  do {
    for (    RecCV cv : curr.componentIndex.get(arg)) {
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + arg + "String_Node_Str"+ cv);
      }
      Arg set=findCanonical(cv);
      if (set != null) {
        markContradiction(set);
      }
    }
    curr=curr.parent;
  }
 while (curr != null);
}

Fixed version (ground truth):
public void markContradiction(Arg arg){
  assert(arg != null);
  arg=findCanonical(arg);
  boolean newContradiction=contradictions.add(arg);
  if (!newContradiction) {
    return;
  }
  CongruentSets curr=this;
  do {
    for (    RecCV setMember : curr.canonicalInv.get(arg)) {
      if (setMember.isArg() && !setMember.arg().equals(arg)) {
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + arg + "String_Node_Str"+ setMember);
        }
        contradictions.add(setMember.arg());
      }
    }
    curr=curr.parent;
  }
 while (curr != null);
  curr=this;
  do {
    for (    RecCV cv : curr.componentIndex.get(arg)) {
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + arg + "String_Node_Str"+ cv);
      }
      Arg set=findCanonical(cv);
      if (set != null) {
        markContradiction(set);
      }
    }
    curr=curr.parent;
  }
 while (curr != null);
}
Program: 132871
Project: 132871
Buggy source:
/** 
 * Check if we can actually access a var here
 * @param var
 * @return
 */
public boolean isAccessible(Var var){
  Arg varArg=var.asArg();
  if (!isUnpassable(varArg)) {
    return true;
  }
  CongruentSets curr=this;
  boolean allPassed=true;
  while (curr != null) {
    if (canonicalInv.containsKey(varArg)) {
      return allPassed;
    }
    allPassed=allPassed && curr.varsFromParent;
    curr=curr.parent;
  }
  throw new STCRuntimeError("String_Node_Str" + var);
}

Fixed version (ground truth):
/** 
 * Check if we can actually access a var here
 * @param var
 * @return
 */
public boolean isAccessible(Var var){
  Arg varArg=var.asArg();
  if (!isUnpassable(varArg)) {
    return true;
  }
  CongruentSets curr=this;
  boolean allPassed=true;
  while (curr != null) {
    if (curr.canonicalInv.containsKey(varArg)) {
      return allPassed;
    }
    allPassed=allPassed && curr.varsFromParent;
    curr=curr.parent;
  }
  throw new STCRuntimeError("String_Node_Str" + var);
}
Program: 132872
Project: 132872
Buggy source:
public Arg arg(){
  return arg;
}

Fixed version (ground truth):
public Arg arg(){
}
Program: 132873
Project: 132873
Buggy source:
public ArgCV cv(){
  return cv;
}

Fixed version (ground truth):
public ArgCV cv(){
}
Program: 132874
Project: 132874
Buggy source:
/** 
 * User friendly string for location.
 * @param assigned
 * @return
 */
private String printableAssignValue(List<Arg> assigned){
  assert(assigned.size() > 0);
  StringBuilder sb=new StringBuilder();
  sb.append(assigned.toString());
  for (  Arg arg : assigned.subList(1,assigned.size())) {
    sb.append("String_Node_Str" + arg + "String_Node_Str");
  }
  return assigned.toString();
}

Fixed version (ground truth):
/** 
 * User friendly string for location.
 * @param assigned
 * @return
 */
private String printableAssignValue(List<Arg> assigned){
  assert(assigned.size() > 0);
  StringBuilder sb=new StringBuilder();
  sb.append(assigned.get(0).toString());
  for (  Arg arg : assigned.subList(1,assigned.size())) {
    sb.append("String_Node_Str" + arg + "String_Node_Str");
  }
  return sb.toString();
}