Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault: eval/die/reference to implied @_ #2040

Closed
p5pRT opened this issue Jun 3, 2000 · 6 comments
Closed

Segmentation fault: eval/die/reference to implied @_ #2040

p5pRT opened this issue Jun 3, 2000 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 3, 2000

Migrated from rt.perl.org#3318 (status was 'resolved')

Searchable as RT3318$

@p5pRT
Copy link
Author

p5pRT commented Jun 3, 2000

From wolfgang.laun@chello.at

Created by Wolfgang.Laun@alcatel.at

A segmentation fault occurs when die is called in an eval-wrapped
nest of subroutine calls where, along the way, a reference to an
implied argument array is stored and all of this this is executed
for the 2nd time.

Note that this does not occur if either the reference is not
stored (1) or the parameter array @​_ is passed explicitly (2).

I condensed the example below from XML​::Writer and its test.pl
which was OK with Perl 5.005_03.

#! /usr/local/bin/perl -w

package X;
use strict;

sub metimpl {
  ### (1) OK if reference is not stored
  my $refarg = \@​_;
  die( "die​: @​_\n" );
};

sub new{
  bless( { method => \&metimpl }, shift );
}

sub method(){
  my $obj = shift;
  ### (2) OK if @​_ is passed explicitly
  &{$obj->{method}};
}
#--------------------------------------------

package main;
use strict;

my $x = new X( 1 );

sub try {
  eval { $x->method( 'foo', 'bar' ); };
  print "Crash​:\n$@​\n" if( defined( $@​ ) );
}

try();
try();

Perl Info

Flags:
    category=core
    severity=critical

Site configuration information for perl v5.6.0:

Configured by root at Sat Mar 25 17:46:37 CET 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.12-20, archname=i586-linux
    uname='linux localhost.localdomain 2.2.12-20 #1 mon sep 27 10:25:54 edt 1999 i586 unknown '
    config_args='-de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:



@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/i586-linux
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.5.670/i586-linux
    /usr/local/lib/perl5/site_perl/5.5.670
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/root
    LANG=en
    LANGUAGE (unset)
    LC_ALL=en_US
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/laune/bin:/usr/X11R6/bin:/home/laune/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


@p5pRT
Copy link
Author

p5pRT commented Jun 5, 2000

From [Unknown Contact. See original ticket]

This is a bug report for perl from Wolfgang.Laun@​alcatel.at,
generated with the help of perlbug 1.28 running under perl v5.6.0.

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

A segmentation fault occurs when die is called in an eval-wrapped
nest of subroutine calls where, along the way, a reference to an
implied argument array is stored and all of this this is executed
for the 2nd time.

Note that this does not occur if either the reference is not
stored (1) or the parameter array @​_ is passed explicitly (2).

I condensed the example below from XML​::Writer and its test.pl
which was OK with Perl 5.005_03.

#! /usr/local/bin/perl -w

package X;
use strict;

sub metimpl {
  ### (1) OK if reference is not stored
  my $refarg = \@​_;
  die( "die​: @​_\n" );
};

sub new{
  bless( { method => \&metimpl }, shift );
}

sub method(){
  my $obj = shift;
  ### (2) OK if @​_ is passed explicitly
  &{$obj->{method}};
}
#--------------------------------------------

package main;
use strict;

my $x = new X( 1 );

sub try {
  eval { $x->method( 'foo', 'bar' ); };
  print "Crash​:\n$@​\n" if( defined( $@​ ) );
}

try();
try();

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

Configured by root at Sat Mar 25 17​:46​:37 CET 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0)
configuration​:
  Platform​:
  osname=linux, osvers=2.2.12-20, archname=i586-linux
  uname='linux localhost.localdomain 2.2.12-20 #1 mon sep 27 10​:25​:54
edt 1999 i586 unknown '
  config_args=-de'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
  useperlio=undef d_sfio=undef uselargefiles=define
  use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
  Compiler​:
  cc='cc', optimize='-O2', gccversion=egcs-2.91.66
19990314/Linux(egcs-1.1.2 release)
  cppflags=-fno-strict-aliasing -I/usr/local/include'
  ccflags ='-fno-strict-aliasing -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
  stdchar='char', d_stdstdio=dDdefine, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  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, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
  libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so,
d_dlsymun=undef,=ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:
 

---
@​INC for perl v5.6.0​:
  /usr/local/lib/perl5/5.6.0/i586-linux
  /usr/local/lib/perl5/5.6.0
  /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
  /usr/local/lib/perl5/site_perl/5.6.0
  /usr/local/lib/perl5/site_perl/5.5.670/i586-linux
  /usr/local/lib/perl5/site_perl/5.5.670
  /usr/local/lib/perl5/site_perl
  .

---
Environment for perl v5.6.0​:
  HOME=/root
  LANG=en
  LANGUAGE (unset)
  LC_ALL=en_US
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
 
PATH=/usr/bin​:/bin​:/usr/X11R6/bin​:/usr/local/bin​:/opt/bin​:/usr/X11R6/bin​:/home/laune/bin​:/usr/X11R6/bin​:/home/laune/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 7, 2000

From [Unknown Contact. See original ticket]

Created by Wolfgang.Laun@alcatel.at

A segmentation fault occurs when die is called in an eval-wrapped
nest of subroutine calls where, along the way, a reference to an
implied argument array is stored and all of this this is executed
for the 2nd time.

Note that this does not occur if either the reference is not
stored (1) or the parameter array @​_ is passed explicitly (2).

I condensed the example below from XML​::Writer and its test.pl
which was OK with Perl 5.005_03.

#! /usr/local/bin/perl -w

package X;
use strict;

sub metimpl {
  ### (1) OK if reference is not stored
  my $refarg =3D \@​_;
  die( "die​: @​_\n" );
};

sub new{
  bless( { method =3D> \&metimpl }, shift );
}

sub method(){
  my $obj =3D shift;
  ### (2) OK if @​_ is passed explicitly
  &{$obj->{method}};
}
#--------------------------------------------

package main;
use strict;

my $x =3D new X( 1 );

sub try {
  eval { $x->method( 'foo', 'bar' ); };
  print "Crash​:\n$@​\n" if( defined( $@​ ) );
}

try();
try();

Perl Info

Flags:
    category=3Dcore
    severity=3Dcritical

Site configuration information for perl v5.6.0:

Configured by root at Sat Mar 25 17:46:37 CET 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=3Dlinux, osvers=3D2.2.12-20, archname=3Di586-linux
    uname=3D'linux localhost.localdomain 2.2.12-20 #1 mon sep 27 10:25:54=
 edt 1999 i586 unknown '
    config_args=3D'-de'
    hint=3Drecommended, useposix=3Dtrue, d_sigaction=3Ddefine
    usethreads=3Dundef use5005threads=3Dundef useithreads=3Dundef=
 usemultiplicity=3Dundef
    useperlio=3Dundef d_sfio=3Dundef uselargefiles=3Ddefine 
    use64bitint=3Dundef use64bitall=3Dundef uselongdouble=3Dundef=
 usesocks=3Dundef
  Compiler:
    cc=3D'cc', optimize=3D'-O2', gccversion=3Degcs-2.91.66 19990314/Linux=
 (egcs-1.1.2 release)
    cppflags=3D'-fno-strict-aliasing -I/usr/local/include'
    ccflags =3D'-fno-strict-aliasing -I/usr/local/include=
 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=3D64'
    stdchar=3D'char', d_stdstdio=3Ddefine, usevfork=3Dfalse
    intsize=3D4, longsize=3D4, ptrsize=3D4, doublesize=3D8
    d_longlong=3Ddefine, longlongsize=3D8, d_longdbl=3Ddefine,=
 longdblsize=3D12
    ivtype=3D'long', ivsize=3D4, nvtype=3D'double', nvsize=3D8,=
 Off_t=3D'off_t', lseeksize=3D8
    alignbytes=3D4, usemymalloc=3Dn, prototype=3Ddefine
  Linker and Libraries:
    ld=3D'cc', ldflags =3D' -L/usr/local/lib'
    libpth=3D/usr/local/lib /lib /usr/lib
    libs=3D-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=3D/lib/libc-2.1.2.so, so=3Dso, useshrplib=3Dfalse,=
 libperl=3Dlibperl.a
  Dynamic Linking:
    dlsrc=3Ddl_dlopen.xs, dlext=3Dso, d_dlsymun=3Dundef,=
 ccdlflags=3D'-rdynamic'
    cccdlflags=3D'-fpic', lddlflags=3D'-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/i586-linux
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl/5.5.670/i586-linux
    /usr/local/lib/perl5/site_perl/5.5.670
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=3D/root
    LANG=3Den
    LANGUAGE (unset)
    LC_ALL=3Den_US
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=3D/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/b=
in:/home/laune/bin:/usr/X11R6/bin:/home/laune/bin
    PERL_BADLANG (unset)
    SHELL=3D/bin/bash


--=====_96004521441=_
Content-Type: text/html; charset="us-ascii"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff style="FONT-FAMILY: Arial; FONT-SIZE: x-small" 
text=#000000>
<DIV><FONT size=2>This is a bug report for perl from <A 
href="mailto:Wolfgang.Laun@alcatel.at">Wolfgang.Laun@alcatel.at</A>,<BR>generated 
with the help of perlbug 1.28 running under perl v5.6.0.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT 
size=2><BR>-----------------------------------------------------------------<BR>[Please 
enter your report here]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>A segmentation fault occurs when die is called in an 
eval-wrapped<BR>nest of subroutine calls where, along the way, a reference to 
an<BR>implied argument array is stored and all of this this is executed<BR>for 
the 2nd time.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Note that this does not occur if either the reference is 
not<BR>stored (1) or the parameter array @_ is passed explicitly 
(2).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>I condensed the example below from XML::Writer and its 
test.pl<BR>which was OK with Perl 5.005_03.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2><BR>#! /usr/local/bin/perl -w</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>package X;<BR>use strict;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>sub metimpl {<BR>&nbsp;&nbsp; ### (1) OK if reference is not 
stored<BR>&nbsp;&nbsp; my $refarg = \@_;<BR>&nbsp;&nbsp; die( "die: @_\n" 
);<BR>};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>sub new{<BR>&nbsp;&nbsp;&nbsp; bless( { method =&gt; 
\&amp;metimpl }, shift );<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>sub method(){<BR>&nbsp;&nbsp;&nbsp; my $obj = 
shift;<BR>&nbsp;&nbsp;&nbsp; ### (2) OK if @_ is passed 
explicitly<BR>&nbsp;&nbsp;&nbsp; 
&amp;{$obj-&gt;{method}};<BR>}<BR>#--------------------------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>package main;<BR>use strict;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>my $x = new X( 1 );</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>sub try {<BR>&nbsp; eval { $x-&gt;method( 'foo', 'bar' ); 
};<BR>&nbsp; print "Crash:\n$@\n" if( defined( $@ ) );<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>try();<BR>try();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>[Please do not change anything below this 
line]<BR>-----------------------------------------------------------------<BR>---<BR>Flags:<BR>&nbsp;&nbsp;&nbsp; 
category=core<BR>&nbsp;&nbsp;&nbsp; severity=critical<BR>---<BR>Site 
configuration information for perl v5.6.0:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Configured by root at Sat Mar 25 17:46:37 CET 
2000.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Summary of my perl5 (revision 5.0 version 6 subversion 0) 
configuration:<BR>&nbsp; Platform:<BR>&nbsp;&nbsp;&nbsp; osname=linux, 
osvers=2.2.12-20, archname=i586-linux<BR>&nbsp;&nbsp;&nbsp; uname='linux 
localhost.localdomain 2.2.12-20 #1 mon sep 27 10:25:54 edt 1999 i586 unknown 
'<BR>&nbsp;&nbsp;&nbsp; config_args='-de'<BR>&nbsp;&nbsp;&nbsp; 
hint=recommended, useposix=true, d_sigaction=define<BR>&nbsp;&nbsp;&nbsp; 
usethreads=undef use5005threads=undef useithreads=undef 
usemultiplicity=undef<BR>&nbsp;&nbsp;&nbsp; useperlio=undef d_sfio=undef 
uselargefiles=define <BR>&nbsp;&nbsp;&nbsp; use64bitint=undef
use64bitall=undef 
uselongdouble=undef usesocks=undef<BR>&nbsp; Compiler:<BR>&nbsp;&nbsp;&nbsp; 
cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 
release)<BR>&nbsp;&nbsp;&nbsp; cppflags='-fno-strict-aliasing 
-I/usr/local/include'<BR>&nbsp;&nbsp;&nbsp; ccflags ='-fno-strict-aliasing 
-I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64'<BR>&nbsp;&nbsp;&nbsp; stdchar='char',
d_stdstdio=define, 
usevfork=false<BR>&nbsp;&nbsp;&nbsp; intsize=4, longsize=4, ptrsize=4, 
doublesize=8<BR>&nbsp;&nbsp;&nbsp; d_longlong=define, longlongsize=8, 
d_longdbl=define, longdblsize=12<BR>&nbsp;&nbsp;&nbsp; ivtype='long',
ivsize=4, 
nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8<BR>&nbsp;&nbsp;&nbsp; 
alignbytes=4, usemymalloc=n, prototype=define<BR>&nbsp; Linker and 
Libraries:<BR>&nbsp;&nbsp;&nbsp; ld='cc', ldflags =' 
-L/usr/local/lib'<BR>&nbsp;&nbsp;&nbsp; libpth=/usr/local/lib /lib 
/usr/lib<BR>&nbsp;&nbsp;&nbsp; libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc 
-lposix -lcrypt<BR>&nbsp;&nbsp;&nbsp; libc=/lib/libc-2.1.2.so, so=so, 
useshrplib=false, libperl=libperl.a<BR>&nbsp; Dynamic 
Linking:<BR>&nbsp;&nbsp;&nbsp; dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, 
ccdlflags='-rdynamic'<BR>&nbsp;&nbsp;&nbsp; cccdlflags='-fpic', 
lddlflags='-shared -L/usr/local/lib'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Locally applied patches:<BR>&nbsp;&nbsp;&nbsp; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>---<BR>@INC for perl v5.6.0:<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/5.6.0/i586-linux<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/5.6.0<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/site_perl/5.6.0/i586-linux<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/site_perl/5.6.0<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/site_perl/5.5.670/i586-linux<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/site_perl/5.5.670<BR>&nbsp;&nbsp;&nbsp; 
/usr/local/lib/perl5/site_perl<BR>&nbsp;&nbsp;&nbsp; .</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>---<BR>Environment for perl v5.6.0:<BR>&nbsp;&nbsp;&nbsp; 
HOME=/root<BR>&nbsp;&nbsp;&nbsp; LANG=en<BR>&nbsp;&nbsp;&nbsp; LANGUAGE 
(unset)<BR>&nbsp;&nbsp;&nbsp; LC_ALL=en_US<BR>&nbsp;&nbsp;&nbsp;
LD_LIBRARY_PATH 
(unset)<BR>&nbsp;&nbsp;&nbsp; LOGDIR (unset)<BR>&nbsp;&nbsp;&nbsp; 
PATH=/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/home/laune/bin:/usr/X11R6/bin:/home/laune/bin<BR>&nbsp;&nbsp;&nbsp; 
PERL_BADLANG (unset)<BR>&nbsp;&nbsp;&nbsp; 
SHELL=/bin/bash<BR></FONT></DIV></BODY></HTML>


--=====_96004521441=_--


@p5pRT
Copy link
Author

p5pRT commented Jun 8, 2000

From [Unknown Contact. See original ticket]

I condensed the example below from XML​::Writer and its test.pl
which was OK with Perl 5.005_03.

#! /usr/local/bin/perl -w

package X;
use strict;

sub metimpl {
### (1) OK if reference is not stored
my $refarg = \@​_;
die( "die​: @​_\n" );
};

sub new{
bless( { method => \&metimpl }, shift );
}

sub method(){
my $obj = shift;
### (2) OK if @​_ is passed explicitly
&{$obj->{method}};
}
#--------------------------------------------

package main;
use strict;

my $x = new X( 1 );

sub try {
eval { $x->method( 'foo', 'bar' ); };
print "Crash​:\n$@​\n" if( defined( $@​ ) );
}

try();
try();

I have reduced this example to

  use strict;
  sub f { my $r = \@​_; die };
  sub g{ &f; }

  eval { g; };
  print "eval 1​: $@​";
  eval { g; };
  print "eval 2​: $@​";

With perl5.00503, this gives the expected​:
eval 1​: Died at nestsubs line 2.
eval 2​: Died at nestsubs line 2.

With perl5.6.0, this gives​:
eval 1​: Died at nestsubs line 2.
Bus Error

If the C<sub f> line is replaced by
  sub f { my $r = \@​_; () = caller(1); die };

perl5.6.0 gives​:
eval 1​: Died at nestsub2 line 2.
Attempt to free unreferenced scalar at nestsub2 line 2.
Attempt to free unreferenced scalar at nestsub2 line 8.
eval 2​: Died at nestsub2 line 2.

So perhaps there is something going wrong with the refcounts
on @​_ in C<sub f> which is @​_ from C<sub g>. Perhaps more
perlgutsier people can see how to fix this.

Robin

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2000

From [Unknown Contact. See original ticket]

This ought to be fixed by​:

http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-06/msg00200.html

Sarathy
gsar@​ActiveState.com

This looked like it might fix 20000603.001; but it didn't. :-(
This is now a one-liner (Bus Error only with -w !)​:

% perl5.6.0 -we 'sub f { my $r = \@​_; last } sub g{ &f } { g } { g }'
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Bus Error

% perl5.6.0 -e 'sub f { my $r = \@​_; last } sub g{ &f } { g } { g }'
Attempt to free unreferenced scalar at -e line 1.
Attempt to free unreferenced scalar at -e line 1.

% perl5.00503 -we 'sub f { my $r = \@​_; last } sub g{ &f } { g } { g }'
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.

% perl5.00503 -e 'sub f { my $r = \@​_; last } sub g{ &f } { g } { g }'

Robin

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2000

From @gsar

On Fri, 09 Jun 2000 18​:47​:13 BST, Robin Barker wrote​:

This ought to be fixed by​:

http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-06/msg00200.html

Sarathy
gsar@​ActiveState.com

This looked like it might fix 20000603.001; but it didn't. :-(
This is now a one-liner (Bus Error only with -w !)​:

% perl5.6.0 -we 'sub f { my $r = \@​_; last } sub g{ &f } { g } { g }'
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Exiting subroutine via last at -e line 1.
Bus Error

Naturally, because you're in the wrong thread. :-)

  http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-06/msg00145.html

Patch welcome.

Sarathy
gsar@​ActiveState.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant