Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #22521] IMCC causes seegfault with many perlarrays and perlhashes

7 views
Skip to first unread message

Clinton A. Pierce

unread,
Jun 2, 2003, 11:29:09 PM6/2/03
to bugs-bi...@rt.perl.org
# New Ticket Created by "Clinton A. Pierce"
# Please include the string: [perl #22521]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22521 >


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.



Leopold Toetsch

unread,
Jun 3, 2003, 4:51:28 AM6/3/03
to perl6-i...@perl.org
Clinton A. Pierce <bugs-...@netlabs.develooper.com> wrote:
> # New Ticket Created by "Clinton A. Pierce"
> # Please include the string: [perl #22521]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22521 >


> I'm not sure what triggers this bug,

... but gdb knows it ;-)

Thanks for the bug report, fixed.

leo

0 new messages