Program: 132694
Project: 132694
Buggy source:
/** 
 * Assuming that branches are exhaustive, work out the set of variables closed after the conditional has executed.
 * @param state
 * @param branchStates
 * @return
 * @throws OptUnsafeError 
 */
public static UnifiedValues unify(Logger logger,GlobalConstants consts,Function fn,boolean reorderingAllowed,int parentStmtIndex,Congruences state,Continuation cont,List<Congruences> branchStates,List<Block> branchBlocks) throws OptUnsafeError {
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + branchBlocks.size() + "String_Node_Str"+ cont.getType());
    for (int i=0; i < branchBlocks.size(); i++) {
      logger.trace("String_Node_Str" + (i + 1) + "String_Node_Str"+ branchBlocks.get(i).getType());
    }
    logger.trace(cont.toString());
  }
  if (branchStates.isEmpty()) {
    return EMPTY;
  }
 else {
    Set<Var> closed=new HashSet<Var>();
    Set<Var> recClosed=new HashSet<Var>();
    unifyClosed(branchStates,closed,recClosed,parentStmtIndex);
    List<ValLoc> availVals=new ArrayList<ValLoc>();
    List<ArgCV> allUnifiedCVs=new ArrayList<ArgCV>();
    Map<List<Arg>,Var> unifiedVars=new HashMap<List<Arg>,Var>();
    int iter=1;
    boolean newCVs;
    do {
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + iter + "String_Node_Str");
      }
      newCVs=false;
      for (      CongruenceType congType : Arrays.asList(CongruenceType.VALUE,CongruenceType.ALIAS)) {
        List<ArgCV> newAllBranchCVs=findAllBranchCVs(state,congType,branchStates,allUnifiedCVs);
        Pair<List<ValLoc>,Boolean> result=unifyCVs(consts,fn,reorderingAllowed,cont.parent(),parentStmtIndex,congType,branchStates,branchBlocks,newAllBranchCVs,unifiedVars);
        availVals.addAll(result.val1);
        if (result.val2) {
          newCVs=true;
        }
        allUnifiedCVs.addAll(newAllBranchCVs);
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + iter + "String_Node_Str"+ congType+ "String_Node_Str"+ result.val1);
        }
      }
      if (iter >= MAX_UNIFY_ITERATIONS) {
        logger.debug("String_Node_Str");
        if (logger.isTraceEnabled()) {
          logger.trace(cont);
        }
        break;
      }
      iter++;
    }
 while (newCVs);
    return new UnifiedValues(closed,recClosed,availVals);
  }
}

Fixed version (ground truth):
/** 
 * Assuming that branches are exhaustive, work out the set of variables closed after the conditional has executed.
 * @param state
 * @param branchStates
 * @return
 * @throws OptUnsafeError
 */
public static UnifiedValues unify(Logger logger,GlobalConstants consts,Function fn,boolean reorderingAllowed,int parentStmtIndex,Congruences state,Continuation cont,List<Congruences> branchStates,List<Block> branchBlocks) throws OptUnsafeError {
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + branchBlocks.size() + "String_Node_Str"+ cont.getType());
    for (int i=0; i < branchBlocks.size(); i++) {
      logger.trace("String_Node_Str" + (i + 1) + "String_Node_Str"+ branchBlocks.get(i).getType());
    }
    logger.trace(cont.toString());
  }
  if (branchStates.isEmpty()) {
    return EMPTY;
  }
 else {
    Set<Var> closed=new HashSet<Var>();
    Set<Var> recClosed=new HashSet<Var>();
    unifyClosed(branchStates,closed,recClosed,parentStmtIndex);
    List<ValLoc> availVals=new ArrayList<ValLoc>();
    List<ArgCV> allUnifiedCVs=new ArrayList<ArgCV>();
    Map<List<Arg>,Var> unifiedVars=new HashMap<List<Arg>,Var>();
    int iter=1;
    boolean newCVs;
    do {
      if (logger.isTraceEnabled()) {
        logger.trace("String_Node_Str" + iter + "String_Node_Str");
      }
      newCVs=false;
      for (      CongruenceType congType : Arrays.asList(CongruenceType.VALUE,CongruenceType.ALIAS)) {
        List<ArgCV> newAllBranchCVs=findAllBranchCVs(state,congType,branchStates,allUnifiedCVs);
        Pair<List<ValLoc>,Boolean> result=unifyCVs(consts,fn,reorderingAllowed,cont.parent(),parentStmtIndex,congType,branchStates,branchBlocks,newAllBranchCVs,unifiedVars);
        availVals.addAll(result.val1);
        if (result.val2) {
          newCVs=true;
        }
        allUnifiedCVs.addAll(newAllBranchCVs);
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + iter + "String_Node_Str"+ congType+ "String_Node_Str"+ result.val1);
        }
      }
      if (iter >= MAX_UNIFY_ITERATIONS) {
        logger.debug("String_Node_Str");
        if (logger.isTraceEnabled()) {
          logger.trace(cont);
        }
        break;
      }
      iter++;
    }
 while (newCVs);
    return new UnifiedValues(closed,recClosed,availVals);
  }
}