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

[perl #75656] lvalue subs don't copy on write

tomushkin @ gmail . com
June 10, 2010 02:15
[perl #75656] lvalue subs don't copy on write
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #75656]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.10.1.

[Please describe your issue here]

$ perl -e 'sub a : lvalue { $a }; $a = __PACKAGE__; a = 1'

The code dies with "Can't return a readonly value from lvalue subroutine".

My quick reasoning:

__PACKAGE__ is FAKE flagged, according to Devel::Peek::Dump().

Checking with perl's source, that seems to be the meanings of the copy on write implementation. 

Consequent, $a is faked and the actual assignment is to be delayed until modification is attempted.

pp_hot.c:2558 where the error comes from doesn't handle the flag.

[Please do not change anything below this line]
Site configuration information for perl 5.10.1:

Configured by Gentoo at Fri Nov 20 14:44:03 EET 2009.

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
    osname=linux, osvers=, archname=i686-linux
    uname='linux oz #2 preempt tue oct 27 16:02:10 eet 2009 i686 intel(r) pentium(r) m processor 1.86ghz genuineintel gnulinux '
    config_args='-des -Duseshrplib -Darchname=i686-linux -Dcc=i686-pc-linux-gnu-gcc -Doptimize=-O2 -march=pentium-m -pipe -fomit-frame-pointer -Dscriptdir=/usr/bin -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dprivlib=/usr/lib/perl5/5.10.1 -Darchlib=/usr/lib/perl5/5.10.1/i686-linux -Dvendorlib=/usr/lib/perl5/vendor_perl/5.10.1 -Dvendorarch=/usr/lib/perl5/vendor_perl/5.10.1/i686-linux -Dsitelib=/usr/lib/perl5/site_perl/5.10.1 -Dsitearch=/usr/lib/perl5/site_perl/5.10.1/i686-linux -Dlocincpth=  -Duselargefiles -Dd_semctl_semun -Dinc_version_list=5.10.0 5.10.0/i686-linux -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Di_ndbm -Di_gdbm -Di_db'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='i686-pc-linux-gnu-gcc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -march=pentium-m -pipe -fomit-frame-pointer',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector'
    ccversion='', gccversion='4.3.4', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    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, prototype=define
  Linker and Libraries:
    ld='i686-pc-linux-gnu-gcc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/, so=so, useshrplib=true,
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -march=pentium-m -pipe -fomit-frame-pointer -L/usr/local/lib -fstack-protector'

Locally applied patches:

@INC for perl 5.10.1:

Environment for perl 5.10.1:
    LANG (unset)
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/zsh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About