Program: 135986
Project: 135986
Buggy source:
/** 
 * Modified by LL on 2 Feb 2006 to add line and column numbers to the    newly created statements for error reporting.                        
 */
private static Vector ExplodeReturn(AST.Return ast,String next) throws PcalTranslateException {
  Vector result=new Vector();
  if (ast.from == null) {
    throw new PcalTranslateException("String_Node_Str",ast);
  }
  ;
  int from=st.FindProc(ast.from);
  PcalSymTab.ProcedureEntry pe=(PcalSymTab.ProcedureEntry)st.procs.elementAt(from);
  PcalDebug.Assert(from < st.procs.size());
  AST.Assign ass=new AST.Assign();
  ass.line=ast.line;
  ass.col=ast.col;
  AST.SingleAssign sass=new AST.SingleAssign();
  sass.line=ast.line;
  sass.col=ast.col;
  TLAExpr expr=new TLAExpr();
  sass.lhs.var="String_Node_Str";
  sass.lhs.sub=new TLAExpr();
  expr.addLine();
  expr.addToken(IdentToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(AddedToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(IdentToken("String_Node_Str"));
  expr.normalize();
  sass.rhs=expr;
  ass.ass=Singleton(sass);
  result.addElement(ass);
  for (int i=0; i < pe.decls.size(); i++) {
    AST.PVarDecl decl=(AST.PVarDecl)pe.decls.elementAt(i);
    ass=new AST.Assign();
    ass.line=ast.line;
    ass.col=ast.col;
    sass=new AST.SingleAssign();
    sass.line=ast.line;
    sass.col=ast.col;
    expr=new TLAExpr();
    sass.lhs.var=decl.var;
    sass.lhs.sub=new TLAExpr();
    expr.addLine();
    expr.addToken(IdentToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(AddedToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(IdentToken(decl.var));
    expr.normalize();
    sass.rhs=expr;
    ass.ass=Singleton(sass);
    result.addElement(ass);
  }
  for (int i=0; i < pe.params.size(); i++) {
    AST.PVarDecl decl=(AST.PVarDecl)pe.params.elementAt(i);
    ass=new AST.Assign();
    ass.line=ast.line;
    ass.col=ast.col;
    sass=new AST.SingleAssign();
    sass.line=ast.line;
    sass.col=ast.col;
    expr=new TLAExpr();
    sass.lhs.var=decl.var;
    sass.lhs.sub=new TLAExpr();
    expr.addLine();
    expr.addToken(IdentToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(AddedToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(IdentToken(decl.var));
    expr.normalize();
    sass.rhs=expr;
    ass.ass=Singleton(sass);
    result.addElement(ass);
  }
  ass=new AST.Assign();
  ass.line=ast.line;
  ass.col=ast.col;
  sass=new AST.SingleAssign();
  sass.line=ast.line;
  sass.col=ast.col;
  expr=new TLAExpr();
  sass.lhs.var="String_Node_Str";
  sass.lhs.sub=new TLAExpr();
  expr.addLine();
  expr.addToken(IdentToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(AddedToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.normalize();
  sass.rhs=expr;
  ass.ass=Singleton(sass);
  result.addElement(ass);
  return result;
}

Fixed version (ground truth):
/** 
 * Modified by LL on 2 Feb 2006 to add line and column numbers to the    newly created statements for error reporting.                        
 */
private static Vector ExplodeReturn(AST.Return ast,String next) throws PcalTranslateException {
  Vector result=new Vector();
  int from=st.FindProc(ast.from);
  PcalSymTab.ProcedureEntry pe=(PcalSymTab.ProcedureEntry)st.procs.elementAt(from);
  PcalDebug.Assert(from < st.procs.size());
  AST.Assign ass=new AST.Assign();
  ass.line=ast.line;
  ass.col=ast.col;
  AST.SingleAssign sass=new AST.SingleAssign();
  sass.line=ast.line;
  sass.col=ast.col;
  TLAExpr expr=new TLAExpr();
  sass.lhs.var="String_Node_Str";
  sass.lhs.sub=new TLAExpr();
  expr.addLine();
  expr.addToken(IdentToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(AddedToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(IdentToken("String_Node_Str"));
  expr.normalize();
  sass.rhs=expr;
  ass.ass=Singleton(sass);
  result.addElement(ass);
  for (int i=0; i < pe.decls.size(); i++) {
    AST.PVarDecl decl=(AST.PVarDecl)pe.decls.elementAt(i);
    ass=new AST.Assign();
    ass.line=ast.line;
    ass.col=ast.col;
    sass=new AST.SingleAssign();
    sass.line=ast.line;
    sass.col=ast.col;
    expr=new TLAExpr();
    sass.lhs.var=decl.var;
    sass.lhs.sub=new TLAExpr();
    expr.addLine();
    expr.addToken(IdentToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(AddedToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(IdentToken(decl.var));
    expr.normalize();
    sass.rhs=expr;
    ass.ass=Singleton(sass);
    result.addElement(ass);
  }
  for (int i=0; i < pe.params.size(); i++) {
    AST.PVarDecl decl=(AST.PVarDecl)pe.params.elementAt(i);
    ass=new AST.Assign();
    ass.line=ast.line;
    ass.col=ast.col;
    sass=new AST.SingleAssign();
    sass.line=ast.line;
    sass.col=ast.col;
    expr=new TLAExpr();
    sass.lhs.var=decl.var;
    sass.lhs.sub=new TLAExpr();
    expr.addLine();
    expr.addToken(IdentToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(AddedToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(BuiltInToken("String_Node_Str"));
    expr.addToken(IdentToken(decl.var));
    expr.normalize();
    sass.rhs=expr;
    ass.ass=Singleton(sass);
    result.addElement(ass);
  }
  ass=new AST.Assign();
  ass.line=ast.line;
  ass.col=ast.col;
  sass=new AST.SingleAssign();
  sass.line=ast.line;
  sass.col=ast.col;
  expr=new TLAExpr();
  sass.lhs.var="String_Node_Str";
  sass.lhs.sub=new TLAExpr();
  expr.addLine();
  expr.addToken(IdentToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.addToken(AddedToken("String_Node_Str"));
  expr.addToken(BuiltInToken("String_Node_Str"));
  expr.normalize();
  sass.rhs=expr;
  ass.ass=Singleton(sass);
  result.addElement(ass);
  return result;
}