Program: 132619
Project: 132619
Buggy source:
public void generateWrappedBuiltin(FnID wrapperID,FnID builtinID,FunctionType ft,List<Var> outArgs,List<Var> userInArgs,ExecTarget mode,boolean isParallel,boolean isTargetable) throws UserException {
  List<Var> realInArgs=new ArrayList<Var>();
  realInArgs.addAll(userInArgs);
  TaskProps props=new TaskProps();
  if (isParallel) {
    Var par=new Var(Types.V_INT,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(par);
    props.put(TaskPropKey.PARALLELISM,par.asArg());
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str");
  }
  if (isTargetable) {
    Var location=new Var(Types.V_INT,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(location);
    props.put(TaskPropKey.LOCATION,location.asArg());
    Var softLocation=new Var(Types.V_BOOL,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(softLocation);
    props.put(TaskPropKey.SOFT_LOCATION,softLocation.asArg());
  }
  Function fn=new Function(wrapperID,realInArgs,outArgs,ExecTarget.syncControl());
  this.program.addFunction(fn);
  WaitMode waitMode;
  if (!mode.isDispatched() && !isParallel) {
    waitMode=WaitMode.WAIT_ONLY;
  }
 else {
    waitMode=WaitMode.TASK_DISPATCH;
  }
  Block mainBlock=fn.mainBlock();
  boolean mustMapOutFiles=!program.foreignFunctions().canInitOutputMapping(builtinID);
  Pair<List<WaitVar>,Map<Var,Var>> p;
  p=WrapUtil.buildWaitVars(mainBlock,mainBlock.statementIterator(),userInArgs,Var.NONE,outArgs,mustMapOutFiles);
  List<WaitVar> waitVars=p.val1;
  Map<Var,Var> filenameVars=p.val2;
  WaitStatement wait=new WaitStatement(wrapperID.uniqueName() + "String_Node_Str",waitVars,PassedVar.NONE,Var.NONE,waitMode,true,mode,props);
  mainBlock.addContinuation(wait);
  Block waitBlock=wait.getBlock();
  List<Statement> instBuffer=new ArrayList<Statement>();
  List<Arg> inVals=WrapUtil.fetchLocalOpInputs(waitBlock,userInArgs,instBuffer,false);
  List<Var> outVals=WrapUtil.createLocalOpOutputs(waitBlock,outArgs,filenameVars,instBuffer,false,mustMapOutFiles,true);
  instBuffer.add(new LocalFunctionCall(wrapperID,inVals,outVals,program.foreignFunctions()));
  WrapUtil.setLocalOpOutputs(waitBlock,outArgs,outVals,instBuffer,!mustMapOutFiles,true);
  waitBlock.addStatements(instBuffer);
}

Fixed version (ground truth):
public void generateWrappedBuiltin(FnID wrapperID,FnID builtinID,FunctionType ft,List<Var> outArgs,List<Var> userInArgs,ExecTarget mode,boolean isParallel,boolean isTargetable) throws UserException {
  List<Var> realInArgs=new ArrayList<Var>();
  realInArgs.addAll(userInArgs);
  TaskProps props=new TaskProps();
  if (isParallel) {
    Var par=new Var(Types.V_INT,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(par);
    props.put(TaskPropKey.PARALLELISM,par.asArg());
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str");
  }
  if (isTargetable) {
    Var location=new Var(Types.V_INT,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(location);
    props.put(TaskPropKey.LOCATION,location.asArg());
    Var softLocation=new Var(Types.V_BOOL,Var.VALUEOF_VAR_PREFIX + "String_Node_Str",Alloc.LOCAL,DefType.INARG,VarProvenance.optimizerTmp());
    realInArgs.add(softLocation);
    props.put(TaskPropKey.SOFT_LOCATION,softLocation.asArg());
  }
  Function fn=new Function(wrapperID,realInArgs,outArgs,ExecTarget.syncControl());
  this.program.addFunction(fn);
  WaitMode waitMode;
  if (!mode.isDispatched() && !isParallel) {
    waitMode=WaitMode.WAIT_ONLY;
  }
 else {
    waitMode=WaitMode.TASK_DISPATCH;
  }
  Block mainBlock=fn.mainBlock();
  boolean mustMapOutFiles=!program.foreignFunctions().canInitOutputMapping(builtinID);
  Pair<List<WaitVar>,Map<Var,Var>> p;
  p=WrapUtil.buildWaitVars(mainBlock,mainBlock.statementIterator(),userInArgs,Var.NONE,outArgs,mustMapOutFiles);
  List<WaitVar> waitVars=p.val1;
  Map<Var,Var> filenameVars=p.val2;
  WaitStatement wait=new WaitStatement(wrapperID.uniqueName() + "String_Node_Str",waitVars,PassedVar.NONE,Var.NONE,waitMode,true,mode,props);
  mainBlock.addContinuation(wait);
  Block waitBlock=wait.getBlock();
  List<Statement> instBuffer=new ArrayList<Statement>();
  List<Arg> inVals=WrapUtil.fetchLocalOpInputs(waitBlock,userInArgs,instBuffer,false);
  List<Var> outVals=WrapUtil.createLocalOpOutputs(waitBlock,outArgs,filenameVars,instBuffer,false,mustMapOutFiles,true);
  instBuffer.add(new LocalFunctionCall(builtinID,inVals,outVals,program.foreignFunctions()));
  WrapUtil.setLocalOpOutputs(waitBlock,outArgs,outVals,instBuffer,!mustMapOutFiles,true);
  waitBlock.addStatements(instBuffer);
}