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

[ID 20000405.015] Minor recursion bug

From:
Miguel Corazao
Date:
April 5, 2000 08:35
Subject:
[ID 20000405.015] Minor recursion bug
Message ID:
200004051534.KAA07230@anhp17.an.intel.com

This is a bug report for perl from miguel.r.corazao@intel.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


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

We're trying out the new 5.6 release. This version has introduced
a new "feature" with respect to using recursion. Try the following
script.

	eval 'exec perl -w -S $0 "$@"'
	        if 0;
	
	use strict;
	
	sub fact ($) {
	    my $n = shift;
	
	    if($n < 2) { return 1; }
	    else { return $n*fact($n-1); }
	}
	
	print fact(4), "\n";

Note that I am using the -w option. I get the following.

	main::fact() called too early to check prototype at rec line 12.
	24

I can work around the problem easily by explicitly pre-declaring the
prototype but, in principle, I shouldn't have to.

Thanks.

- Miguel

P.S. I think this has always been sort of a problem since I've noticed
that Perl never seems to check prototypes in recursion. I think the
extra check that was added simply hilighted the problem.

P.P.S. FYI we're also noting some seg faults in certain apps using Tk.
We've yet to isolate what specifically is failing.


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

Configured by mthooks at Fri Mar 31 13:52:57 CST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=hpux, osvers=10.20, archname=PA-RISC2.0
    uname='hp-ux anhp96 b.10.20 a 9000785 2015349244 two-user license '
    config_args='-des -Dprefix=/an/dm/work/mthooks/perl -Dcc=gcc -Doptimize=-O3 -N -Dlocincpth=/an/dm/work/mthooks/perl/include -Dloclibpth=/an/dm/work/mthooks/perl/lib'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=undef 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O3 -N', gccversion=2.8.1
    cppflags='-D_HPUX_SOURCE -L/lib/pa1.1 -DUINT32_MAX_BROKEN'
    ccflags ='-D_HPUX_SOURCE -L/lib/pa1.1 -DUINT32_MAX_BROKEN'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =''
    libpth=/lib /usr/lib /usr/ccs/lib /usr/local/lib
    libs=-lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt -lsec
    libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
    cccdlflags='-fpic', lddlflags='-b'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    ../../ITk/src
    /an/ec/beta/hp9000.10.20/lib/perl5/site_perl/5.005/PA-RISC2.0
    .
    /home/mrcoraza/lib/perl
    /an/dm/dist/common/latest/lib/perl
    /an/dm/dist/catsgen/latest/lib/perl
    /an/dm/work/mthooks/perl/lib/5.6.0/PA-RISC2.0
    /an/dm/work/mthooks/perl/lib/5.6.0
    /an/dm/work/mthooks/perl/lib/site_perl/5.6.0/PA-RISC2.0
    /an/dm/work/mthooks/perl/lib/site_perl/5.6.0
    /an/dm/work/mthooks/perl/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home/mrcoraza
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib:/usr/intel/CURRENT/lib:/an/dm/dist/commmon/latest/lib/hp9000.10.20
    LOGDIR (unset)
    PATH=/an/dm/dist/catsgen/latest/bin/scripts:.:/an/dm/work/mthooks/perl/bin:/home/mrcoraza/bin:/an/ec/beta/hp9000.10.20/bin:/usr/intel/bin:/usr/bin:/etc:/usr/etc:/usr/ccs/bin:/usr/afsws/bin:/usr/afsws/etc:/usr/local/bin:/an/tools/bin:/usr/dt/bin:/usr/vue/bin:/usr/bin/X11:/usr/contrib/bin:/usr/contrib/bin/X11:/an/ec/FrameMaker/bin:/home/mrcoraza/bin:/opt/aCC/bin:/an/dm/dist/common/latest/bin/scripts:/an/dm/dist/common/latest/bin/hp9000.10.20:/an/dm/local/bin
    PERLLIB=../../ITk/src:/an/ec/beta/hp9000.10.20/lib/perl5/site_perl/5.005/PA-RISC2.0:.:/home/mrcoraza/lib/perl:/an/dm/dist/common/latest/lib/perl:/an/dm/dist/catsgen/latest/lib/perl
    PERL_BADLANG (unset)
    SHELL=/usr/intel/bin/tcsh
    SHLIB_PATH=/an/dm/vendor/sycon/latest/mw/lib-ux10:/an/dm/vendor/sycon/latest/mw/lib-ux10_optimized:.



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