I'm not sure what triggers this bug, but I can reliably reproduce it. The
code is *far* too large to list here, but this perl script will generate
the appropriate code in larger and larger samples until it starts
crashing. Adjust as appropriate:
for($s=10; $s<10000; $s+=100) {
print "Number: $s\n";
open(IMCC, ">foo.imc") || die;
print IMCC <<HEAD;
.sub main
call _bug
end
.end
.sub _bug
saveall
\$P1=new PerlHash
\$P2=new PerlArray
HEAD
for $l (0..$s) {
print IMCC <<BODY;
\$P0=new PerlArray
set \$P0[0], "FOO"
set \$P0[1], "BAR"
push \$P2, \$P0
set \$P1["FOO$l"], $l
BODY
}
print IMCC<<FOOT;
restoreall
ret
.end
FOOT
close(IMCC);
system('..\..\imcc\imcc.exe foo.imc');
}
This cycles through with 110, 210, 310, repetitions of something like the
following:
.sub main
call _bug
end
.end
.sub _bug
saveall
$P1=new PerlHash
$P2=new PerlArray
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO0"], 0
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO1"], 1
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO2"], 2
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO3"], 3
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO4"], 4
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
set $P1["FOO5"], 5
$P0=new PerlArray
set $P0[0], "FOO"
set $P0[1], "BAR"
push $P2, $P0
# And so on.....
restoreall
ret
.end
My system bails with a segfault at around 300-400 repetitions. More if I
make the .data sub the only thing in the .imc file. This bug causes both
chess and eliza to bail, as each has largish static data initializations.
> I'm not sure what triggers this bug,
... but gdb knows it ;-)
Thanks for the bug report, fixed.
leo