Program: 132934
Project: 132934
Buggy source:
/** 
 * Generate backend instruction for function call
 * @param context
 * @param function name of function
 * @param oList list of output variables
 * @param iList list of input variables (with correct types)
 * @param priorityVal optional priority value (can be null)
 * @throws UserException 
 */
private void backendFunctionCall(Context context,String function,List<Var> oList,ArrayList<Var> iList,TaskProps props) throws UserException {
  props.assertInternalTypesValid();
  FunctionType def=context.lookupFunction(function);
  if (def == null) {
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str" + function);
  }
  if (context.hasFunctionProp(function,FnProp.BUILTIN)) {
    if (Builtins.hasOpEquiv(function)) {
      assert(oList.size() <= 1);
      Var out=oList.size() == 0 ? null : oList.get(0);
      backend.asyncOp(Builtins.getOpEquiv(function),out,Arg.fromVarList(iList),props);
    }
 else {
      backend.builtinFunctionCall(function,iList,oList,props);
    }
  }
 else   if (context.hasFunctionProp(function,FnProp.COMPOSITE)) {
    System.err.println(function + "String_Node_Str");
    TaskMode mode;
    if (context.hasFunctionProp(function,FnProp.SYNC)) {
      mode=TaskMode.SYNC;
    }
 else {
      mode=TaskMode.CONTROL;
    }
    backend.functionCall(function,Var.asArgList(iList),oList,mode,props);
  }
 else {
    assert(context.hasFunctionProp(function,FnProp.WRAPPED_BUILTIN) || context.hasFunctionProp(function,FnProp.APP));
    List<Arg> realInputs=new ArrayList<Arg>();
    for (    Var in : iList) {
      realInputs.add(in.asArg());
    }
    if (context.hasFunctionProp(function,FnProp.PARALLEL)) {
      Arg par=props.get(TaskPropKey.PARALLELISM);
      if (par == null) {
        throw new UserException(context,"String_Node_Str" + "String_Node_Str" + function);
      }
      realInputs.add(par);
    }
    if (context.hasFunctionProp(function,FnProp.TARGETABLE)) {
      Arg target=props.getWithDefault(TaskPropKey.LOCATION);
      realInputs.add(target);
    }
    assert(context.hasFunctionProp(function,FnProp.SYNC));
    TaskMode mode=TaskMode.SYNC;
    backend.functionCall(function,realInputs,oList,mode,props);
  }
}

Fixed version (ground truth):
/** 
 * Generate backend instruction for function call
 * @param context
 * @param function name of function
 * @param oList list of output variables
 * @param iList list of input variables (with correct types)
 * @param priorityVal optional priority value (can be null)
 * @throws UserException 
 */
private void backendFunctionCall(Context context,String function,List<Var> oList,ArrayList<Var> iList,TaskProps props) throws UserException {
  props.assertInternalTypesValid();
  FunctionType def=context.lookupFunction(function);
  if (def == null) {
    throw new STCRuntimeError("String_Node_Str" + "String_Node_Str" + function);
  }
  if (context.hasFunctionProp(function,FnProp.BUILTIN)) {
    if (Builtins.hasOpEquiv(function)) {
      assert(oList.size() <= 1);
      Var out=oList.size() == 0 ? null : oList.get(0);
      backend.asyncOp(Builtins.getOpEquiv(function),out,Arg.fromVarList(iList),props);
    }
 else {
      backend.builtinFunctionCall(function,iList,oList,props);
    }
  }
 else   if (context.hasFunctionProp(function,FnProp.COMPOSITE)) {
    TaskMode mode;
    if (context.hasFunctionProp(function,FnProp.SYNC)) {
      mode=TaskMode.SYNC;
    }
 else {
      mode=TaskMode.CONTROL;
    }
    backend.functionCall(function,Var.asArgList(iList),oList,mode,props);
  }
 else {
    assert(context.hasFunctionProp(function,FnProp.WRAPPED_BUILTIN) || context.hasFunctionProp(function,FnProp.APP));
    List<Arg> realInputs=new ArrayList<Arg>();
    for (    Var in : iList) {
      realInputs.add(in.asArg());
    }
    if (context.hasFunctionProp(function,FnProp.PARALLEL)) {
      Arg par=props.get(TaskPropKey.PARALLELISM);
      if (par == null) {
        throw new UserException(context,"String_Node_Str" + "String_Node_Str" + function);
      }
      realInputs.add(par);
    }
    if (context.hasFunctionProp(function,FnProp.TARGETABLE)) {
      Arg target=props.getWithDefault(TaskPropKey.LOCATION);
      realInputs.add(target);
    }
    assert(context.hasFunctionProp(function,FnProp.SYNC));
    TaskMode mode=TaskMode.SYNC;
    backend.functionCall(function,realInputs,oList,mode,props);
  }
}