The RSV_LOCAL offset should be the the local variable, not of the local variable within the block
Notice though, that the executor doesn't even use it.
There is more detail in the attached script.
listfile before:
/vagrant/testsuite/escript/bug/bug013-local-variable-index.src, Line 7
program foo()
var a; // should be 0
0: decl local #0
1: #
if ( a )
2: local #0
3: if false goto 17
var b; // should be 1 actually emitted 0
4: decl local #0
5: #
var c; // should be 2 actually emitted 1
6: decl local #1
7: #
if ( b )
8: local #1
9: if false goto 16
var d; // should be 3 actually emitted 0
10: decl local #0
11: #
print(d);
12: local #3
13: Func(1,0): Print
14: #
15: leave block(1)
16: leave block(2)
17: leave block(1)
18: progend
listfile after:
/vagrant/testsuite/escript/bug/bug013-local-variable-index.src, Line 7
program foo()
var a; // should be 0
0: decl local #0
1: #
if ( a )
2: local #0
3: if false goto 17
var b; // should be 1 actually emitted 0
4: decl local #1
5: #
var c; // should be 2 actually emitted 1
6: decl local #2
7: #
if ( b )
8: local #1
9: if false goto 16
var d; // should be 3 actually emitted 0
10: decl local #3
11: #
print(d);
12: local #3
13: Func(1,0): Print
14: #
15: leave block(1)
16: leave block(2)
17: leave block(1)
18: progend