Program: 132975
Project: 132975
Buggy source:
/** 
 * Update variable passing for nested continuation
 * @param logger
 * @param function
 * @param outerCx exec context outside of continuation
 * @param continuation
 * @param visible
 * @param referencedGlobals
 * @param outerBlockVars
 * @param neededVars
 * @param updateLists 
 */
private static void fixupContinuationRec(Logger logger,Function function,ExecContext outerCx,Continuation continuation,HierarchicalSet<Var> visible,Set<Var> referencedGlobals,Set<Var> outerBlockVars,Set<Var> read,Set<Var> written,boolean updateLists){
  List<Var> constructVars=continuation.constructDefinedVars();
  ExecContext innerCx=continuation.childContext(outerCx);
  for (  Block innerBlock : continuation.getBlocks()) {
    HierarchicalSet<Var> childVisible=visible.makeChild();
    for (    Var v : constructVars) {
      childVisible.add(v);
    }
    Pair<Set<Var>,Set<Var>> inner=fixupBlockRec(logger,function,innerBlock,innerCx,childVisible,referencedGlobals,updateLists);
    Set<Var> innerRead=inner.val1;
    Set<Var> innerWritten=inner.val2;
    if (!constructVars.isEmpty()) {
      innerRead.removeAll(constructVars);
      innerWritten.removeAll(constructVars);
    }
    if (continuation.inheritsParentVars()) {
      innerRead.removeAll(outerBlockVars);
      read.addAll(innerRead);
      innerWritten.removeAll(outerBlockVars);
      written.addAll(innerWritten);
    }
 else     if (updateLists) {
      rebuildContinuationPassedVars(function,continuation,visible,outerBlockVars,read,innerRead,written,innerWritten);
      rebuildContinuationKeepOpenVars(function,continuation,visible,outerBlockVars,written,innerWritten);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update variable passing for nested continuation
 * @param logger
 * @param function
 * @param outerCx exec context outside of continuation
 * @param continuation
 * @param visible
 * @param referencedGlobals
 * @param outerBlockVars
 * @param neededVars
 * @param updateLists 
 */
private static void fixupContinuationRec(Logger logger,Function function,ExecContext outerCx,Continuation continuation,HierarchicalSet<Var> visible,Set<Var> referencedGlobals,Set<Var> outerBlockVars,Set<Var> read,Set<Var> written,boolean updateLists){
  List<Var> constructVars=continuation.constructDefinedVars(ContVarDefType.NEW_DEF);
  ExecContext innerCx=continuation.childContext(outerCx);
  for (  Block innerBlock : continuation.getBlocks()) {
    HierarchicalSet<Var> childVisible=visible.makeChild();
    for (    Var v : constructVars) {
      childVisible.add(v);
    }
    Pair<Set<Var>,Set<Var>> inner=fixupBlockRec(logger,function,innerBlock,innerCx,childVisible,referencedGlobals,updateLists);
    Set<Var> innerRead=inner.val1;
    Set<Var> innerWritten=inner.val2;
    if (!constructVars.isEmpty()) {
      innerRead.removeAll(constructVars);
      innerWritten.removeAll(constructVars);
    }
    if (continuation.inheritsParentVars()) {
      innerRead.removeAll(outerBlockVars);
      read.addAll(innerRead);
      innerWritten.removeAll(outerBlockVars);
      written.addAll(innerWritten);
    }
 else     if (updateLists) {
      rebuildContinuationPassedVars(function,continuation,visible,outerBlockVars,read,innerRead,written,innerWritten);
      rebuildContinuationKeepOpenVars(function,continuation,visible,outerBlockVars,written,innerWritten);
    }
  }
}