Subject: | pairmap segfaults |
Hello!
I had data strucutre on which Perl terminated abnormally when perofrming pairmap. I have narrowed down it to this test case (I'm sorry I didn't make it shorter, but it's the shortest version which breaks perl).
Backtrace:
/lib64/libc.so.6(+0x7e9d6)[0x7ff8056c69d6]
/lib64/libc.so.6(+0x7f783)[0x7ff8056c7783]
/usr/lib64/libperl.so.5.16(Perl_av_extend+0x1db)[0x7ff805aa1f5b]
/usr/lib64/libperl.so.5.16(Perl_stack_grow+0x2f)[0x7ff805ad140f]
/usr/lib64/libperl.so.5.16(Perl_pp_mapwhile+0x37c)[0x7ff805adb7ac]
/usr/lib64/libperl.so.5.16(Perl_runops_standard+0x13)[0x7ff805aa3c83]
/usr/lib64/perl5/vendor_perl/5.16.3/x86_64-linux/auto/List/Util/Util.so(+0x4943)[0x7ff8048a8943]
/usr/lib64/libperl.so.5.16(Perl_pp_entersub+0x645)[0x7ff805aab6e5]
/usr/lib64/libperl.so.5.16(Perl_runops_standard+0x13)[0x7ff805aa3c83]
/usr/lib64/libperl.so.5.16(perl_run+0x3ca)[0x7ff805a49bea]
/usr/bin/perl(main+0x11b)[0x400f2b]
I hope my test case would work for you.
Thank you in advance!
Subject: | pairmap-bug.pl |
#! /usr/bin/perl
use strict;
use warnings;
use List::Util qw(pairmap);
my @x = (
'a' => [
'1',
[
'b' => [ '2', '3', '4' ],
'c' => [ '5', '6', '7', '8', '9', '10', '11', '12' ],
'd' => [ '13', '14', '15', '16', '17', '18',
'19', '20', '21', '22', '23',
'24', '25', '26', '27', '28', '29',
'30', '31', '32' ],
]
],
);
sub _extract {
map { ref $_ ? pairmap(\&_extract, @$_) : $_ } @$b;
}
pairmap(\&_extract, @x);