Program: 132693
Project: 132693
Buggy source:
/** 
 * Merge computed values from different conditional branches
 * @param parent
 * @param branchStates
 * @param branchBlocks
 * @param allBranchCVs
 * @param unifiedLocs 
 * @return
 * @throws OptUnsafeError 
 */
private static Pair<List<ValLoc>,Boolean> unifyCVs(GlobalConstants consts,Function fn,boolean reorderingAllowed,Block parent,int parentStmtIndex,CongruenceType congType,List<Congruences> branchStates,List<Block> branchBlocks,List<ArgCV> allBranchCVs,Map<List<Arg>,Var> unifiedLocs) throws OptUnsafeError {
  List<ValLoc> availVals=new ArrayList<ValLoc>();
  boolean createdNewBranchCVs=false;
  for (  ArgCV cv : allBranchCVs) {
    boolean allVals=true;
    boolean allSameLocation=true;
    Closed allClosed=Closed.YES_RECURSIVE;
    IsValCopy anyValCopy=IsValCopy.NO;
    List<Arg> branchLocs=new ArrayList<Arg>(branchStates.size());
    Arg firstLoc=branchStates.get(0).findCanonical(cv,congType);
    for (int i=0; i < branchStates.size(); i++) {
      Congruences bs=branchStates.get(i);
      Arg loc=bs.findCanonical(cv,congType);
      assert(loc != null);
      if (loc != firstLoc && !loc.equals(firstLoc)) {
        allSameLocation=false;
      }
      if (!Types.isPrimValue(loc.type())) {
        allVals=false;
      }
      int branchStmtCount=branchBlocks.get(i).getStatements().size();
      if (allClosed == Closed.YES_RECURSIVE && !bs.isRecClosed(loc,branchStmtCount)) {
        if (bs.isClosed(loc,branchStmtCount)) {
          allClosed=Closed.MAYBE_NOT;
        }
 else {
          allClosed=Closed.YES_NOT_RECURSIVE;
        }
      }
 else       if (allClosed == Closed.YES_NOT_RECURSIVE && !bs.isClosed(loc,branchStmtCount)) {
        allClosed=Closed.MAYBE_NOT;
      }
      branchLocs.add(loc);
    }
    if (Logging.getSTCLogger().isTraceEnabled()) {
      Logging.getSTCLogger().trace(cv + "String_Node_Str" + "String_Node_Str"+ allSameLocation+ "String_Node_Str"+ allVals);
    }
    IsAssign isAssign=IsAssign.NO;
    if (allSameLocation) {
      availVals.add(createUnifiedCV(cv,firstLoc,allClosed,anyValCopy,isAssign));
    }
 else     if (unifiedLocs.containsKey(branchLocs)) {
      Var unifiedLoc=unifiedLocs.get(branchLocs);
      availVals.add(createUnifiedCV(cv,unifiedLoc.asArg(),allClosed,anyValCopy,isAssign));
    }
 else {
      Var unifiedLoc=createUnifyingVar(consts,fn,parent,branchStates,branchBlocks,branchLocs,firstLoc.type());
      createdNewBranchCVs=true;
      unifiedLocs.put(branchLocs,unifiedLoc);
      availVals.add(createUnifiedCV(cv,unifiedLoc.asArg(),allClosed,anyValCopy,isAssign));
    }
  }
  return Pair.create(availVals,createdNewBranchCVs);
}

Fixed version (ground truth):
/** 
 * Merge computed values from different conditional branches
 * @param parent
 * @param branchStates
 * @param branchBlocks
 * @param allBranchCVs
 * @param unifiedLocs
 * @return
 * @throws OptUnsafeError
 */
private static Pair<List<ValLoc>,Boolean> unifyCVs(GlobalConstants consts,Function fn,boolean reorderingAllowed,Block parent,int parentStmtIndex,CongruenceType congType,List<Congruences> branchStates,List<Block> branchBlocks,List<ArgCV> allBranchCVs,Map<List<Arg>,Var> unifiedLocs) throws OptUnsafeError {
  List<ValLoc> availVals=new ArrayList<ValLoc>();
  boolean createdNewBranchCVs=false;
  for (  ArgCV cv : allBranchCVs) {
    boolean allVals=true;
    boolean allSameLocation=true;
    Closed allClosed=Closed.YES_RECURSIVE;
    IsValCopy anyValCopy=IsValCopy.NO;
    List<Arg> branchLocs=new ArrayList<Arg>(branchStates.size());
    Arg firstLoc=branchStates.get(0).findCanonical(cv,congType);
    for (int i=0; i < branchStates.size(); i++) {
      Congruences bs=branchStates.get(i);
      Arg loc=bs.findCanonical(cv,congType);
      assert(loc != null);
      if (loc != firstLoc && !loc.equals(firstLoc)) {
        allSameLocation=false;
      }
      if (!Types.isPrimValue(loc.type())) {
        allVals=false;
      }
      int branchStmtCount=branchBlocks.get(i).getStatements().size();
      if (allClosed.isRecClosed() && bs.isRecClosed(loc,branchStmtCount)) {
        allClosed=Closed.YES_RECURSIVE;
      }
 else       if (allClosed.isClosed() && bs.isClosed(loc,branchStmtCount)) {
        allClosed=Closed.YES_NOT_RECURSIVE;
      }
 else {
        allClosed=Closed.MAYBE_NOT;
      }
      branchLocs.add(loc);
    }
    if (Logging.getSTCLogger().isTraceEnabled()) {
      Logging.getSTCLogger().trace(cv + "String_Node_Str" + "String_Node_Str"+ allSameLocation+ "String_Node_Str"+ allVals);
    }
    IsAssign isAssign=IsAssign.NO;
    if (allSameLocation) {
      availVals.add(createUnifiedCV(cv,firstLoc,allClosed,anyValCopy,isAssign));
    }
 else     if (unifiedLocs.containsKey(branchLocs)) {
      Var unifiedLoc=unifiedLocs.get(branchLocs);
      availVals.add(createUnifiedCV(cv,unifiedLoc.asArg(),allClosed,anyValCopy,isAssign));
    }
 else {
      Var unifiedLoc=createUnifyingVar(consts,fn,parent,branchStates,branchBlocks,branchLocs,firstLoc.type());
      createdNewBranchCVs=true;
      unifiedLocs.put(branchLocs,unifiedLoc);
      availVals.add(createUnifiedCV(cv,unifiedLoc.asArg(),allClosed,anyValCopy,isAssign));
    }
  }
  return Pair.create(availVals,createdNewBranchCVs);
}