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

[perl #117929] [5.16] Unreferenced scalar in recursion

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
May 9, 2013 23:50
Subject:
[perl #117929] [5.16] Unreferenced scalar in recursion
Message ID:
rt-3.6.HEAD-6955-1368143398-927.117929-15-0@perl.org
On Thu May 09 09:49:24 2013, victor.adam@derpymail.org wrote:
> I have some (horrifyingly golfed) code to recursively build a binary
search
> tree, based on an array containing the depth of the elements (as described
> in RFC 1951 <http://www.ietf.org/rfc/rfc1951.txt>, pp.6–8). It works fine
> under Perl 5.8 and 5.14, but it breaks loudly under 5.16, with 15 “Attempt
> to free unreferenced scalar” messages.
> 
> Here is the simplest version I could come up with that still triggers the
> bug:
> 
> sub rec {
> $depth++;
> return @_ if $depth == 16;
> @_ = ((grep { $_[$_] == $depth } 0..$#_), &rec);
> map { [shift, shift] } @_
> }
> 
> rec(1, 1)


I can confirm that I get this in Perl 5.16.0 but not in 5.14.2.  But I
can't understand your program well enough (e.g., why are you assigning
to @_ ?) to help further.

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=117929

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