ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
[ID 20000929.002] Self-tied arrays cause core dump
by Alan Burlison other posts by this author
Sep 30 2000 12:20AM messages near this date
DOC PATCH 5.6.0 | Re: Perlbug proposal: OK: perl v5.7.0 +DEVEL6995onaix4.3.1.0(UNINSTALLED)
This is a bug report for perl from alanbur@[...].com,
generated with the help of perlbug 1.28 running under perl v5.6.0.


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

Self-tied arrays cause core dumps.  With the following code:

package MyTie;
sub new
{
my ($class) = @_;
my @self;
tie(@self, $class, \@self);
return(\@self);
}
sub TIEARRAY
{
print("TIEARRAY @_\n");
bless $_[1], $_[0]
}
sub FETCH
{
print("FETCH @_\n");
return($_[0]-> [$_[1]]);
}
package main;
my $tie = MyTie-> new();
my $val = $tie-> [0];

This happens:

Deep recursion on subroutine "MyTie::FETCH" at bug line 23.
TIEARRAY MyTie ARRAY(0x44818)
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0
FETCH MyTie=ARRAY(0x44818) 0

[many identical lines snipped]

Segmentation Fault(coredump)

If the line

   tie(@self, $class, \@self);

is changed to

   my @tied;
   tie(@self, $class, \@tied);

The problem doesn't occur.  This also happens in 5.005_03 and 5.7.0.

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

Configured by alanbur at Thu Sep 14 15:49:46 BST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.9, archname=sun4-solaris-multi-64int
    uname='sunos mower 5.9 s81_21 sun4u sparc sunw,ultra-60 '
    config_args='-dsOE -Dprefix=/home1/software/perl/debug -Dinstallprefix=/home1/software/p
erl/debug -Dsiteprefix=/home1/software/perl/debug -Doptimize=-g -Duseshrplib -Uusemymalloc -
Ubincompat5005 -Duse64bitint -Dusemultiplicity -Accflags=-DPURIFY'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=define use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=
    cppflags='-DPURIFY -DDEBUGGING -I/usr/local/include'
    ccflags ='-DPURIFY -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_B
ITS=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=16
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/SUNWspro/WS6/lib '
    libpth=/usr/local/lib /opt/SUNWspro/WS6/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -R /home1/software/perl/debu
g/lib/5.6.0/sun4-solaris-multi-64int/CORE'
    cccdlflags='-KPIC', lddlflags='-G -L/usr/local/lib -L/opt/SUNWspro/WS6/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /home1/software/perl/debug/lib/5.6.0/sun4-solaris-multi-64int
    /home1/software/perl/debug/lib/5.6.0
    /home1/software/perl/debug/lib/site_perl/5.6.0/sun4-solaris-multi-64int
    /home1/software/perl/debug/lib/site_perl/5.6.0
    /home1/software/perl/debug/lib/site_perl
    .

---
Environment for perl v5.6.0:
    HOME=/home1/alanbur
    LANG=C
    LANGUAGE (unset)
    LC_COLLATE=en_GB.ISO8859-1
    LC_CTYPE=en_GB.ISO8859-1
    LC_MESSAGES=C
    LC_MONETARY=en_GB.ISO8859-1
    LC_NUMERIC=en_GB.ISO8859-1
    LC_TIME=en_GB.ISO8859-1
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/ccs/bin:/home1/software/perl/debug/bin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/o
pt/SUNWspro/bin:/usr/dt/bin:/usr/openwin/bin:/home1/alanbur/bin:.:/usr/dist/exe:/usr/dist/lo
cal/exe
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved