develooper Front page | perl.perl5.porters | Postings from March 2007

[perl #42255] Infinite recursion error with closures

Thread Next
From:
Zsbán Ambrus
Date:
March 31, 2007 16:46
Subject:
[perl #42255] Infinite recursion error with closures
Message ID:
rt-3.6.HEAD-30557-1175348503-730.42255-75-0@perl.org
# New Ticket Created by  "Zsbán Ambrus" 
# Please include the string:  [perl #42255]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42255 >


This is a bug report for perl from ambrus@math.bme.hu,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------
[Please enter your report here]


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 {});

__END__


I cannot see how uncommenting that line could make any difference.

Kudos to pKai by helping me pinpoint the bug.

Thanks,

Ambrus


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.8.8:

Configured by ambrus at Mon May 22 23:16:27 CEST 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.4.27-3-686, archname=i686-linux
    uname='linux king 2.4.27-3-686 #1 wed feb 8 12:40:33 utc 2006 i686
gnulinux '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-13)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.8:
    /usr/local/lib/perl5/5.8.8/i686-linux
    /usr/local/lib/perl5/5.8.8
    /usr/local/lib/perl5/site_perl/5.8.8/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.8
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.8.8:
    HOME=/home/ambrus
    LANG (unset)
    LANGUAGE=en_HU:en_US:en_GB:en
    LC_CTYPE=hu_HU
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ambrus/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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