Hi,
This was a straight forward fix. The line number was being decremented
at the start of a 'sub' token imcc.y.
Thanks,
Vishal
Here is a sample run
Sample Code:
-------------------
.sub main :main
print "2\n"
print "3\n"
print "4\n"
.end
Output:
--------
./parrot -d 10 ./hello.pir
1
last:5
pcc_sub main nparams 0
Dumping the instructions status:
-------------------------------
nins line blck deep flags type opnr size pc X ins
0 1 0 0 0 80000 -1 0 0 main:
1 2 0 0 1 0 413 2 0 print "2\n"
2 3 0 0 1 0 413 2 2 print "3\n"
3 4 0 0 1 0 413 2 4 print "4\n"
4 4 0 0 0 18000 0 1 6 end
Labels
name pos last ref
-----------------------
Dumping the CFG:
-------------------------------
0 (0) -> <-
Dumping the Dominators Tree:
-------------------------------
0 <- ( 0) 0
Loop info
---------
Patch
--------
Index: compilers/imcc/imcc.y
===================================================================
--- compilers/imcc/imcc.y (revision 13035)
+++ compilers/imcc/imcc.y (working copy)
@@ -202,7 +202,7 @@
r->type = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED :
VT_PCC_SUB;
r->pcc_sub = calloc(1, sizeof(struct pcc_sub_t));
cur_call = r;
- i->line = line - 1;
+ i->line = line ;
add_namespace(interp, unit);
return i;
}