develooper Front page | perl.perl5.porters | Postings from May 2015

[perl #125244] perls (including bleadperl) segfault/etc. with recursion+sub{}+map pure-Perl code.

Thread Previous | Thread Next
From:
shlomif @ shlomifish . org
Date:
May 24, 2015 13:13
Subject:
[perl #125244] perls (including bleadperl) segfault/etc. with recursion+sub{}+map pure-Perl code.
Message ID:
rt-4.0.18-19915-1432473170-91.125244-75-0@perl.org
# New Ticket Created by  shlomif@shlomifish.org 
# Please include the string:  [perl #125244]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125244 >


Hi all,

the following code:

< CODE >

#!perl
@F=(0..9,0);
sub r{
    my($y,@x)=@_;
    map{
        ref$_ ? (&$_) :$_
    }
    @d=(@F,
    ($y && sub{@F[$y-1,-1-$y]=($")x2;r(@x)}),
    @F%2|$y?@F:())
}
print r 1,1,3..@F/2-1

< / CODE >

Gives me this:

< SHELL >
shlomif@telaviv1:~/Download/unpack/perl/p5/possible-perl-bug-segfault-on-nAF$
perl perl-bug.pl
Bizarre copy of UNKNOWN in map iterator at perl-bug.pl line 9.
Attempt to free unreferenced scalar: SV 0xf8b408, Perl interpreter: 0xf57010 at
perl-bug.pl line 9.
shlomif@telaviv1:~/Download/unpack/perl/p5/possible-perl-bug-segfault-on-nAF$ 
/home/shlomif/apps/perl/bleadperl/bin/perl5.22.0 perl-bug.pl
panic: attempt to copy freed scalar 2335670 to 233af70 at perl-bug.pl line 9.
Segmentation fault
shlomif@telaviv1:~/Download/unpack/perl/p5/possible-perl-bug-segfault-on-nAF$
perl -v

This is perl 5, version 20, subversion 1 (v5.20.1) built for
x86_64-linux-thread-multi (with 1 registered patch, see perl -V for more detail)

Copyright 1987-2014, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

shlomif@telaviv1:~/Download/unpack/perl/p5/possible-perl-bug-segfault-on-nAF$ 

< / SHELL>

This code can also be found here:

https://github.com/shlomif/possible-perl-bug--sandglass-golf

Some credits - a similar program was written as a solution for this shinh.org
golf:

http://golf.shinh.org/p.rb?sandglass

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Emma Watson Factoids - http://shlom.in/emwatson-facts

I feel much better, now that I’ve given up hope.
    — Ashleigh Brilliant

Please reply to list if it's a mailing list post - http://shlom.in/reply .


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About