develooper Front page | perl.perl5.porters | Postings from November 2000

Re: [ID 20000722.003] Perl: nested closure crashes on Linux

From:
Benjamin Holzman
Date:
November 27, 2000 15:18
Subject:
Re: [ID 20000722.003] Perl: nested closure crashes on Linux
Message ID:
20001127181941.T25040@ecnvantage.com
I know what's wrong with

	sub a { }
	my @b;
	sub { a $b[0]; sub c { a $b[0] }; c }->();

from both the Perl level (declaring a global sub inside an anonymous codeblock
is dubious at best) and the C level (although the TARG for the padav in sub c
is correct, it ends up that PL_curpad is wrong [1 too high], and UNDEF gets put
on the stack instead of @b, which results in a segfault at AvFILL(av) in
pp_hot.c:2791 (perl@7892).  I can't quite figure out why.  @b has to be a
lexical array, the arguments to a() have to be padav aelems, it has to be
called from an anonymous codeblock and the first call to a() has to be lexically
before the subroutine definition.

Does anyone have any clue?

Ben
-- 
Benjamin Holzman				ECNvantage Corp.
Chief Technical Officer 			295 Park Avenue S., Suite 7C
(212) 358-0436 : bah@ecnvantage.com		New York, NY, 10010
$ perl -le 'print join $" ,reverse map ucfirst ,qw{ hacker perl another just}'



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