Program: 75297
Project: 75297
Buggy source:
/** 
 * Generate the memory allocation code for the output ports that are of type array. The order of ports in model has effect on the order of driver input parameters
 */
private static void _arrayVariablesAllocationCode(TypedCompositeActor model) throws IllegalActionException {
  FHfuncVarDeclString+="String_Node_Str" + _endLine;
  FCVarInitString+="String_Node_Str" + _endLine + "String_Node_Str"+ _endLine;
  Iterator actors=model.entityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    String actorName=StringUtilities.sanitizeName(((NamedObj)actor).getName());
    FHfuncVarDeclString+="String_Node_Str" + actorName + _endLine;
    FCVarInitString+=_tabChar + "String_Node_Str" + actorName+ _endLine;
    for (Iterator ports=actor.outputPortList().iterator(); ports.hasNext(); ) {
      TypedIOPort port=(TypedIOPort)ports.next();
      String portType=_getTypeString(port);
      if (portType.endsWith("String_Node_Str")) {
        String sanitizedPortName=StringUtilities.sanitizeName(port.getName(model));
        String arrayLength=_getArrayLength(port);
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FCVarInitString+=_tabChar + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
        FCVarInitString+=_tabChar + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
      }
    }
    for (Iterator ports=actor.inputPortList().iterator(); ports.hasNext(); ) {
      TypedIOPort port=(TypedIOPort)ports.next();
      String portType=_getTypeString(port);
      if (portType.endsWith("String_Node_Str")) {
        String sanitizedPortName=StringUtilities.sanitizeName(port.getName(model));
        List sourcePortList=port.sourcePortList();
        if (sourcePortList.size() > 1) {
          throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str");
        }
        TypedIOPort sport=(TypedIOPort)port.sourcePortList().get(0);
        String arrayLength=_getArrayLength(sport);
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FCVarInitString+=_tabChar + sanitizedPortName + "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
      }
    }
  }
  FCVarInitString+="String_Node_Str" + _endLine;
}

Fixed version (ground truth):
/** 
 * Generate the memory allocation code for the output ports that are of type array. The order of ports in model has effect on the order of driver input parameters
 */
private static void _arrayVariablesAllocationCode(TypedCompositeActor model) throws IllegalActionException {
  FHfuncVarDeclString+="String_Node_Str" + _endLine;
  FCVarInitString+="String_Node_Str" + _endLine + "String_Node_Str"+ _endLine;
  Iterator actors=model.entityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    String actorName=StringUtilities.sanitizeName(((NamedObj)actor).getName());
    FHfuncVarDeclString+="String_Node_Str" + actorName + _endLine;
    FCVarInitString+=_tabChar + "String_Node_Str" + actorName+ _endLine;
    for (Iterator ports=actor.outputPortList().iterator(); ports.hasNext(); ) {
      TypedIOPort port=(TypedIOPort)ports.next();
      String portType=_getTypeString(port);
      if (portType.endsWith("String_Node_Str")) {
        String sanitizedPortName=StringUtilities.sanitizeName(port.getName(model));
        String arrayLength=_getArrayLength(port);
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FHfuncVarDeclString+="String_Node_Str" + portType + "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+="String_Node_Str" + portType + "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FCVarInitString+=_tabChar + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
        FCVarInitString+=_tabChar + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
      }
    }
    for (Iterator ports=actor.inputPortList().iterator(); ports.hasNext(); ) {
      TypedIOPort port=(TypedIOPort)ports.next();
      String portType=_getTypeString(port);
      if (portType.endsWith("String_Node_Str")) {
        String sanitizedPortName=StringUtilities.sanitizeName(port.getName(model));
        List sourcePortList=port.sourcePortList();
        if (sourcePortList.size() > 1) {
          throw new IllegalActionException(port,"String_Node_Str" + "String_Node_Str");
        }
        TypedIOPort sport=(TypedIOPort)port.sourcePortList().get(0);
        String arrayLength=_getArrayLength(sport);
        FHfuncVarDeclString+=portType.substring(0,portType.length() - 5) + "String_Node_Str" + sanitizedPortName+ "String_Node_Str"+ arrayLength+ "String_Node_Str"+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FHfuncVarDeclString+="String_Node_Str" + portType + "String_Node_Str"+ actorName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
        FHfuncVarDeclString+=_endLine;
        FCVarInitString+=_tabChar + actorName + "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ sanitizedPortName+ "String_Node_Str"+ _endLine;
      }
    }
  }
  FCVarInitString+="String_Node_Str" + _endLine;
}