Program: 171600
Project: 171600
Buggy source:
/** 
 * Main compiler loop Iterates over each statement, identifies the statement type, and then calls a more specialized compiler method
 */
public static void compile(){
  ArrayList<CallStatement> calls=new ArrayList<CallStatement>();
  mainROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(CallStackPointer,1),new Arg(CallStackPointer,0),"String_Node_Str"));
  while (tokens.size() > 0) {
    clearS();
    if (tokens.get(0).equals("String_Node_Str")) {
      CallStatement call=new CallStatement(mainROM.size(),rmStatementTokens());
      if (call.pointerName() != null) {
        Subroutine isLocal=null;
        for (int i=subs.size() - 1; i >= 0; i--) {
          if (subs.get(i).args.contains(call.pointerName())) {
            isLocal=subs.get(i);
          }
        }
        if (call.returnsPointer) {
          if (isLocal == null) {
            type.put(call.pointerName(),call.subName());
          }
 else {
            isLocal.type.put(call.pointerName(),call.subName());
          }
        }
      }
      calls.add(0,call);
      prevCall=call;
    }
 else {
      if (tokens.get(0).equals("String_Node_Str")) {
        compileDef();
      }
 else       if (tokens.get(0).equals("String_Node_Str") || tokens.get(0).equals("String_Node_Str")) {
        compileLoopStart(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileDoWhile(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileSub(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileLoopStop(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileReturn(mainROM);
        mainROM.get(mainROM.size() - 1).tags.add("String_Node_Str");
      }
 else {
        compileMove(mainROM);
      }
      prevCall=null;
    }
  }
  for (int i=0; i < calls.size(); i++) {
    clearS();
    compileCall(mainROM,calls.get(i));
  }
  setRAM(firstFreeRAM,CallStackPointer);
  type.put(CallStackPointer,arrayType);
  firstFreeRAM++;
}

Fixed version (ground truth):
/** 
 * Main compiler loop Iterates over each statement, identifies the statement type, and then calls a more specialized compiler method
 */
public static void compile(){
  ArrayList<CallStatement> calls=new ArrayList<CallStatement>();
  mainROM.add(new Command("String_Node_Str",new Arg(-1),new Arg(CallStackPointer,1),new Arg(CallStackPointer,0),"String_Node_Str"));
  while (tokens.size() > 0) {
    clearS();
    if (tokens.get(0).equals("String_Node_Str")) {
      CallStatement call=new CallStatement(mainROM.size(),rmStatementTokens());
      if (call.pointerName() != null) {
        Subroutine isLocal=null;
        for (int i=subs.size() - 1; i >= 0; i--) {
          if (subs.get(i).args.contains(call.pointerName())) {
            isLocal=subs.get(i);
          }
        }
        if (call.returnsPointer) {
          if (isLocal == null) {
            type.put(call.pointerName(),call.subName());
          }
 else {
            isLocal.type.put(call.pointerName(),call.subName());
          }
        }
      }
      calls.add(0,call);
      prevCall=call;
    }
 else {
      int startsize=mainROM.size();
      if (tokens.get(0).equals("String_Node_Str")) {
        compileDef();
      }
 else       if (tokens.get(0).equals("String_Node_Str") || tokens.get(0).equals("String_Node_Str")) {
        compileLoopStart(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileDoWhile(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileSub(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileLoopStop(mainROM);
      }
 else       if (tokens.get(0).equals("String_Node_Str")) {
        compileReturn(mainROM);
        mainROM.get(mainROM.size() - 1).tags.add("String_Node_Str");
      }
 else {
        compileMove(mainROM);
      }
      if (mainROM.size() > startsize) {
        prevCall=null;
      }
    }
  }
  for (int i=0; i < calls.size(); i++) {
    clearS();
    compileCall(mainROM,calls.get(i));
  }
  setRAM(firstFreeRAM,CallStackPointer);
  type.put(CallStackPointer,arrayType);
  firstFreeRAM++;
}