.sub _main
goto L1
test:
$I1 = 1
ret
L1:
.local int i
i = 2
call test
print i # prints 1, not 2
end
.end
parrot -o - t.imc shows:
_main:
branch L1
test:
set I16, 1
ret
L1:
set I16, 2
bsr test
print I16
end
Is this a bug, or am I missing something?
Pete
PS this happens on pow builds 0.0.11 (20/09/03), and 15/11/03
Pete
http://palacebuilders.pwp.blueyonder.co.uk/euphoria.html
Yep. The problem seems to be the backward branch. When you put the
"test" sub after the "end" op, its working fine.
leo
At quick glance I would guess IMCC assumes that the "call test" branches
to a basic block that doesn't overlap with the callee basic block.
Much (most) of the flow analysis code was done before we adopted
new calling conventions. I'll have a look to see if there a quick fix
that would allow the code snippet sample to be legal.
-Melvin
As Leo said, it is backward branch. $I1 and $I2 can both get stored in
the same register, as can .local int i and .local int j. I'm just
pointing out that my subject line was a little misleading.
Pete