Program: 132939
Project: 132939
Buggy source:
/** 
 * @param execCx 
 * @param block
 * @param cv copy of cv from outer scope, or null if it should be initialized
 * @param replaceInputs : a set of variable replaces to do from this point in IC onwards
 * @return true if this should be called again
 * @throws InvalidOptionException
 * @throws InvalidWriteException
 */
private boolean forwardDataflow(Logger logger,Program program,Function f,ExecContext execCx,Block block,State cv,HierarchicalMap<Var,Arg> replaceInputs,HierarchicalMap<Var,Arg> replaceAll) throws InvalidOptionException, InvalidWriteException {
  if (block.getType() == BlockType.MAIN_BLOCK) {
    for (    WaitVar wv : f.blockingInputs()) {
      cv.close(wv.var,false);
    }
    for (    Var v : f.getInputList()) {
      if (Types.isScalarUpdateable(v.type())) {
        cv.close(v,false);
      }
    }
  }
  for (  Var v : block.getVariables()) {
    if (v.isMapped() && Types.isFile(v.type())) {
      ResultVal filenameVal=ICInstructions.filenameCV(Arg.createVar(v.mapping()),v);
      cv.addComputedValue(filenameVal,false);
    }
    if (Types.isMappable(v.type()) && !v.isMapped() && v.storage() != VarStorage.ALIAS) {
      cv.setUnmapped(v);
    }
  }
  boolean inlined=handleStatements(logger,program,f,execCx,block,block.statementIterator(),cv,replaceInputs,replaceAll);
  if (inlined) {
    cleanupAfterInline(block,replaceInputs,replaceAll);
    return true;
  }
  block.renameCleanupActions(replaceInputs,RenameMode.VALUE);
  block.renameCleanupActions(replaceAll,RenameMode.REFERENCE);
  for (int i=0; i < block.getContinuations().size(); i++) {
    Continuation c=block.getContinuation(i);
    c.renameVars(replaceInputs,RenameMode.VALUE,false);
    c.renameVars(replaceAll,RenameMode.REFERENCE,false);
    Block toInline=c.tryInline(cv.getClosed(),cv.getRecursivelyClosed(),keepExplicitWaits);
    if (toInline != null) {
      c.inlineInto(block,toInline);
      i--;
      inlined=true;
    }
  }
  if (inlined) {
    cleanupAfterInline(block,replaceInputs,replaceAll);
    return true;
  }
  for (  Continuation cont : block.getContinuations()) {
    recurseOnContinuation(logger,program,f,execCx,cont,cv,replaceInputs,replaceAll);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param execCx 
 * @param block
 * @param cv copy of cv from outer scope, or null if it should be initialized
 * @param replaceInputs : a set of variable replaces to do from this point in IC onwards
 * @return true if this should be called again
 * @throws InvalidOptionException
 * @throws InvalidWriteException
 */
private boolean forwardDataflow(Logger logger,Program program,Function f,ExecContext execCx,Block block,State cv,HierarchicalMap<Var,Arg> replaceInputs,HierarchicalMap<Var,Arg> replaceAll) throws InvalidOptionException, InvalidWriteException {
  if (block.getType() == BlockType.MAIN_BLOCK) {
    for (    WaitVar wv : f.blockingInputs()) {
      cv.close(wv.var,false);
    }
    for (    Var v : f.getInputList()) {
      if (Types.isScalarUpdateable(v.type())) {
        cv.close(v,false);
      }
    }
  }
  for (  Var v : block.getVariables()) {
    if (v.isMapped() && Types.isFile(v.type())) {
      ResultVal filenameVal=ICInstructions.filenameCV(Arg.createVar(v.mapping()),v);
      cv.addComputedValue(filenameVal,false);
    }
    if (Types.isMappable(v.type()) && !v.isMapped() && v.storage() != VarStorage.ALIAS) {
      cv.setUnmapped(v);
    }
  }
  boolean inlined=handleStatements(logger,program,f,execCx,block,block.statementIterator(),cv,replaceInputs,replaceAll);
  if (inlined) {
    cleanupAfterInline(block,replaceInputs,replaceAll);
    return true;
  }
  block.renameCleanupActions(replaceInputs,RenameMode.VALUE);
  block.renameCleanupActions(replaceAll,RenameMode.REFERENCE);
  for (int i=0; i < block.getContinuations().size(); i++) {
    Continuation c=block.getContinuation(i);
    c.renameVars(replaceInputs,RenameMode.VALUE,false);
    c.renameVars(replaceAll,RenameMode.REFERENCE,false);
    Block toInline=c.tryInline(cv.getClosed(),cv.getRecursivelyClosed(),reorderingAllowed);
    if (toInline != null) {
      c.inlineInto(block,toInline);
      i--;
      inlined=true;
    }
  }
  if (inlined) {
    cleanupAfterInline(block,replaceInputs,replaceAll);
    return true;
  }
  for (  Continuation cont : block.getContinuations()) {
    recurseOnContinuation(logger,program,f,execCx,cont,cv,replaceInputs,replaceAll);
  }
  return false;
}