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

[perl #43077] goto & behaviour doesn't match documentation

Thread Next
From:
Bo Lindbergh
Date:
May 30, 2007 17:07
Subject:
[perl #43077] goto & behaviour doesn't match documentation
Message ID:
rt-3.6.HEAD-1668-1180533048-402.43077-75-0@perl.org
# New Ticket Created by  Bo Lindbergh 
# Please include the string:  [perl #43077]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43077 >


This is a bug report for perl from blgl@hagernas.com,
generated with the help of perlbug 1.35 running under perl v5.8.8.


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

The documentation for goto & says:
 > Instead, it exits the current subroutine (losing any changes
 > set by local()) and immediately calls in its place the named
 > subroutine using the current value of @_.

Actually, it reuses the current argument array, which isn't
necessarily the same as @_.  The example program below shows
the difference.

Either goto & should be modified to use @_ or the documentation
should be modified to match reality.


#! /usr/local/bin/perl

use strict;

sub inner
{
     print "@_\n";
}

sub indirect
{
     *_=[qw(modified argument list)];
     &inner;         # outputs "modified argument list"
     goto &inner;    # outputs "original arguments"
}

indirect(qw(original arguments));

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

Configured by blgl at Fri Jun  9 19:26:53 CEST 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
   Platform:
     osname=darwin, osvers=8.6.0, archname=darwin-thread- 
multi-64int-2level
     uname='darwin sunwukung.sth.ownit.se 8.6.0 darwin kernel version  
8.6.0: tue mar 7 16:58:48 pst 2006;  
root:xnu-792.6.70.obj~1release_ppc power macintosh powerpc '
     config_args=''
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define  
usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=define use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp - 
fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/ 
include',
     optimize='-Os',
     cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp- 
precomp -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/ 
usr/local/include'
     ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build  
5247)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
     ivtype='long long', ivsize=8, nvtype='double', nvsize=8,  
Off_t='off_t', lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/ 
local/lib'
     libpth=/usr/local/lib /usr/lib
     libs=-lc
     perllibs=-lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false,  
libperl=libperl.a
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/ 
usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.8:
     /usr/local/lib/perl5/5.8.8/darwin-thread-multi-64int-2level
     /usr/local/lib/perl5/5.8.8
     /usr/local/lib/perl5/site_perl/5.8.8/darwin-thread- 
multi-64int-2level
     /usr/local/lib/perl5/site_perl/5.8.8
     /usr/local/lib/perl5/site_perl
     .

---
Environment for perl v5.8.8:
     DYLD_LIBRARY_PATH (unset)
     HOME=/Users/blgl
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=/Users/blgl/bin:/Users/blgl/bin/powerpc-apple-darwin:/usr/ 
local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/arla/bin
     PERL_BADLANG (unset)
     SHELL=/bin/tcsh


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