develooper Front page | perl.perl5.porters | Postings from February 2002

[ID 20020220.008] Something very wrong with gotoLABEL

Thread Next
From:
Mike Guy
Date:
February 20, 2002 09:11
Subject:
[ID 20020220.008] Something very wrong with gotoLABEL
Message ID:
E16daG2-0000b0-00@libra.cus.cam.ac.uk
A colleague reports that goto LABEL out of a Tie method is broken:

-------------------------------------------------------------------
The following transcript distils the cause of the bus
errors I mentioned last night.

All we have here is wrong output - how did we get back to
point A? If I step through it with the debugger, a different
route is taken, ending in a segmentation violation.

Session transcript follows:

cj10@curlew$ cat v
#!/bin/perl -w

{ package MyTie;

  sub TIEHANDLE { bless [] }

  sub PRINT {
    print "point C\n"; 
    goto BANG
  }
}

open NULL, "/dev/null" or die "open";
tie *NULL, "MyTie";
print NULL "Hello";
print "Point A\n";
BANG:
print "Point B\n";

cj10@curlew$ ./v
point C
Point B
Point A
Point B
cj10@curlew$ 
-------------------------------------------------------------------

I confirm that this still happens with bleadperl.

As an additional data point, a tied scalar gives a different error:

perl -w
{ package MyTie;

  sub TIESCALAR { bless [] }
  sub FETCH {
      print "point C\n";
      goto BANG;
  };
};

tie my ($x), 'MyTie';
print $x;
print "Point A\n";
BANG:
print "Point B\n";
__END__
point C
Can't find label BANG at - line 5.


Mike Guy

perl -V
Summary of my perl5 (revision 5.0 version 7 subversion 2 patch 14574) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos nmg3 5.6 generic_105181-04 sun4u sparc sunw,ultra-1 '
    config_args='undef'
    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=define
  Compiler:
    cc='/usr/local/bin/gcc', ccflags ='-I/usr/local/include -I/opt/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='2.7.2.3', gccosandvers='solaris2.6'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/usr/local/bin/gcc', ldflags =' -L/usr/local/lib -L/opt/local/lib '
    libpth=/usr/local/lib /opt/local/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -L/opt/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Locally applied patches:
  	DEVEL14574
  	IV.consts
  	doc.SUPER
  	setuid.stat
  Built under solaris
  Compiled at Feb 11 2002 01:03:57
  %ENV:
    PERL="perl5.7.x"
  @INC:
    /home/mjtg/perl5.7.x/lib
    /home/mjtg/perl5.7.x/lib
    /home/mjtg/perl5.7.x/lib
    /home/mjtg/perl5.7.x/lib
    /home/mjtg/perl5.7.x/lib
    .


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