develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #81290] assertion failure with lock &lvalue_sub

From:
Nicholas Clark
Date:
December 26, 2010 03:37
Subject:
[perl #81290] assertion failure with lock &lvalue_sub
Message ID:
rt-3.6.HEAD-5425-1293351241-1520.81290-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #81290]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81290 >



This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.13.8.


-----------------------------------------------------------------
[Please describe your issue here]

$ ./perl -e 'sub foo :lvalue {$a}; lock &foo'
perl: pp.c:6133: Perl_pp_lock: Assertion `((svtype)((retsv)->sv_flags & 0xff)) != SVt_PVCV' failed.
Aborted

I'm inferring that this bug was introduced with this change:

commit 076a2a80a09d79b056f73d9ef04bd4d977712fce
Author: Jerry D. Hedden <jdhedden@cpan.org>
Date:   Wed Jan 21 11:03:38 2009 -0500

    Code refs aren't lockable
    
    Remove the check for code refs in pp_lock.
    For debugging, assert that the ref is not a code ref
    (per Dave Mitchell's suggestion).

diff --git a/pp.c b/pp.c
old mode 100644
new mode 100755
index aacb789..9cedc3f
--- a/pp.c
+++ b/pp.c
@@ -5062,9 +5062,9 @@ PP(pp_lock)
     dSP;
     dTOPss;
     SV *retsv = sv;
+    assert(SvTYPE(retsv) != SVt_PVCV);
     SvLOCK(sv);
-    if (SvTYPE(retsv) == SVt_PVAV || SvTYPE(retsv) == SVt_PVHV
-	|| SvTYPE(retsv) == SVt_PVCV) {
+    if (SvTYPE(retsv) == SVt_PVAV || SvTYPE(retsv) == SVt_PVHV) {
 	retsv = refto(retsv);
     }
     SETs(retsv);


Logically, should "locking" an LVALUE subroutine actually lock the return
value?

Nicholas Clark

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.13.8:

Configured by nick at Sun Dec 26 06:22:11 GMT 2010.

Summary of my perl5 (revision 5 version 13 subversion 8) configuration:
  Derived from: f5d415344cd77e5641abbd31dc8d3080776508ea
  Platform:
    osname=linux, osvers=2.6.35.4, archname=x86_64-linux
    uname='linux eris 2.6.35.4 #4 smp tue sep 21 09:54:22 bst 2010 x86_64 gnulinux '
    config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads -Uuselongdouble -Uuse64bitall -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153 -Uusevendorprefix -Uvendorprefix=~/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153 -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -Umad -Accccflags-DPURIFY -de'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='ccache gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.3.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.7'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.13.8:
    lib
    /home/nick/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153/lib/perl5/site_perl/5.13.8/x86_64-linux
    /home/nick/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153/lib/perl5/site_perl/5.13.8
    /home/nick/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153/lib/perl5/5.13.8/x86_64-linux
    /home/nick/Sandpit/snap5.9.x-v5.13.8-35-gf5d4153/lib/perl5/5.13.8
    .

---
Environment for perl 5.13.8:
    HOME=/home/nick
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/nick/Install/git160/libexec/git-core/:/home/nick/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash




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