[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: [perl #42255] Infinite recursion error with closures
From:       Dave Mitchell <davem () iabyn ! com>
Date:       2007-03-31 23:53:39
Message-ID: 20070331235338.GG4895 () iabyn ! com
[Download RAW message or body]

On Sat, Mar 31, 2007 at 06:41:43AM -0700, Zsbán Ambrus wrote:
> The following program falls into an infinite recursion with the warning
> "Deep recursion on anonymous subroutine at alapm.pl line 17."  When,
> however, you uncomment the line marked with an arrow, it will do what I
> think is the correct behaiviour: the program exits without doing anything.
> 
> 
> #!perl
> # alapm.pl -- reduced example for a possible interpreter bug
> # by ambrus
> 
> use warnings;
> use strict;
> 
> sub poss {
> 	my($v, $f) = @_;
> 	if ($v) {
> 		&$f();
> 	} else {
> 		my(@vv2) = ();
> 		poss(1, sub {
> 			#my $fwr_unused = $f; # <----
> 			for my $k (0 .. @vv2) {
> 				&{sub { &$f() }}();
> 			}
> 		});
> 	}
> }
> 
> poss(0, sub {});

Thanks for the report. This issue has been fixed in the development branch
of perl, from 5.9.0 onwards.

-- 
"The GPL violates the U.S. Constitution, together with copyright,
antitrust and export control laws"
    -- SCO smoking crack again.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic