Program: 132826
Project: 132826
Buggy source:
/** 
 * Select the location to insert the array build instruction
 * @param block
 * @param array
 * @param keys
 * @param vals
 * @return
 */
private ListIterator<Statement> findArrayBuildPos(Logger logger,Block block,InitState outerInit,Var array,List<Arg> keys,List<Arg> vals){
  Set<Var> needsInit=new HashSet<Var>();
  if (InitVariables.varMustBeInitialized(array,true)) {
    if (!outerInit.initVars.contains(array)) {
      needsInit.add(array);
    }
  }
  for (  Arg key : keys) {
    if (key.isVar()) {
      assert(InitVariables.assignBeforeRead(key.getVar()));
      if (!outerInit.assignedVals.contains(key.getVar())) {
        needsInit.add(key.getVar());
      }
    }
  }
  for (  Arg val : vals) {
    assert(val.isVar());
    if (InitVariables.varMustBeInitialized(val.getVar(),false)) {
      if (!outerInit.initVars.contains(val.getVar())) {
        needsInit.add(val.getVar());
      }
    }
  }
  InitState blockInit=outerInit.enterBlock(block);
  ListIterator<Statement> insertPos=block.statementIterator();
  while (insertPos.hasNext() && !needsInit.isEmpty()) {
    Statement stmt=insertPos.next();
    InitVariables.updateInitVars(logger,stmt,blockInit,false);
    Iterator<Var> it=needsInit.iterator();
    while (it.hasNext()) {
      Var v=it.next();
      if (InitVariables.assignBeforeRead(v)) {
        if (blockInit.assignedVals.contains(v)) {
          it.remove();
        }
      }
 else       if (InitVariables.varMustBeInitialized(v,false)) {
        if (blockInit.initVars.contains(v)) {
          it.remove();
        }
      }
    }
  }
  if (!needsInit.isEmpty()) {
    logger.warn("String_Node_Str" + needsInit + "String_Node_Str");
  }
  return insertPos;
}

Fixed version (ground truth):
/** 
 * Select the location to insert the array build instruction
 * @param block
 * @param array
 * @param keys
 * @param vals
 * @return
 */
private ListIterator<Statement> findArrayBuildPos(Logger logger,Block block,InitState outerInit,Var array,List<Arg> keys,List<Arg> vals){
  Set<Var> needsInit=new HashSet<Var>();
  if (InitVariables.varMustBeInitialized(array,true)) {
    if (!outerInit.initVars.contains(array)) {
      needsInit.add(array);
    }
  }
  for (  Arg key : keys) {
    if (key.isVar()) {
      assert(InitVariables.assignBeforeRead(key.getVar()));
      if (!outerInit.assignedVals.contains(key.getVar())) {
        needsInit.add(key.getVar());
      }
    }
  }
  for (  Arg val : vals) {
    if (val.isVar() && InitVariables.varMustBeInitialized(val.getVar(),false)) {
      if (!outerInit.initVars.contains(val.getVar())) {
        needsInit.add(val.getVar());
      }
    }
  }
  InitState blockInit=outerInit.enterBlock(block);
  ListIterator<Statement> insertPos=block.statementIterator();
  while (insertPos.hasNext() && !needsInit.isEmpty()) {
    Statement stmt=insertPos.next();
    InitVariables.updateInitVars(logger,stmt,blockInit,false);
    Iterator<Var> it=needsInit.iterator();
    while (it.hasNext()) {
      Var v=it.next();
      if (InitVariables.assignBeforeRead(v)) {
        if (blockInit.assignedVals.contains(v)) {
          it.remove();
        }
      }
 else       if (InitVariables.varMustBeInitialized(v,false)) {
        if (blockInit.initVars.contains(v)) {
          it.remove();
        }
      }
    }
  }
  if (!needsInit.isEmpty()) {
    logger.warn("String_Node_Str" + needsInit + "String_Node_Str");
  }
  return insertPos;
}