[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    [perl #102486] strict subs fails with lvalue subroutines
From:       "Eric Strom via RT" <perlbug-comment () perl ! org>
Date:       2011-10-30 22:33:42
Message-ID: rt-3.6.HEAD-31297-1320014021-188.102486-14-0 () perl ! org
[Download RAW message or body]

Sorry about the dup postings, the whitespace keeps being mangled. 
Trying a file attachment now.

["strict_bug.txt" (text/plain)]

Subject: strict subs fails with lvalue subroutines
Message-Id: <5.15.3_4541_1318900144@linux-op1p>
Reply-To: asg@cpan.org
To: perlbug@perl.org
From: asg@cpan.org


This is a bug report for perl from asg@cpan.org,
generated with the help of perlbug 1.39 running under perl 5.15.3.


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

the test file:

    #!/usr/bin/env perl

    use warnings;
    use strict;

    print "perl v$]\n---\n";

    sub abc_string {
        my $x = die 'abc_string called';
    }
    sub abc_string_lvalue :lvalue {
        my $x = die 'abc_string_lvalue called';
    }
    sub abc {
        my $x = "abc_string@_";
        &$x
    }
    sub abc_lvalue :lvalue {
        my $x = "abc_string@_";
        &$x
    }
    eval {abc                 ; 1} or print "abc died:                  $@\n";
    eval {abc_lvalue          ; 1} or print "abc_lvalue died:           $@\n";
    eval {abc        '_lvalue'; 1} or print "abc 'lvalue' died:         $@\n";
    eval {abc_lvalue '_lvalue'; 1} or print "abc_lvalue '_lvalue' died: $@\n";

results in:

    perl v5.015003
    ---
    abc died:                  Can't use string ("abc_string") as a subroutine ref \
while "strict refs" in use at test.pl line 16.

    abc_lvalue died:           Can't modify non-lvalue subroutine call at test.pl \
line 20.

    abc 'lvalue' died:         Can't use string ("abc_string_lvalue") as a subroutine \
ref while "strict refs" in use at test.pl line 16.

    abc_lvalue '_lvalue' died: abc_string_lvalue called at test.pl line 12.

---

the two abc_lvalue() calls should die from "strict refs" but instead both
continue past and fail for other reasons.

the bug has been observed in perl 5.10.1 and 5.15.3 (the latter of which is
shown below).


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=high
    module=strict
---
Site configuration information for perl 5.15.3:

Configured by asg at Fri Oct 14 03:28:43 EDT 2011.

Summary of my perl5 (revision 5 version 15 subversion 3) configuration:
  Commit id: 1aa032b25ab39eebe4a452ff935a39107a322a5b
  Platform:
    osname=linux, osvers=2.6.37.6-0.7-desktop, archname=i686-linux
    uname='linux linux-op1p 2.6.37.6-0.7-desktop #1 smp preempt 2011-07-21 02:17:24 \
+0200 i686 i686 i386 gnulinux '  config_args=''
    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
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector \
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',  optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.5.1 20101208 [gcc-4_5-branch revision 167585]', \
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='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.3.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.3'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:


---
@INC for perl 5.15.3:
    /usr/local/lib/perl5/site_perl/5.15.3/i686-linux
    /usr/local/lib/perl5/site_perl/5.15.3
    /usr/local/lib/perl5/5.15.3/i686-linux
    /usr/local/lib/perl5/5.15.3
    /usr/local/lib/perl5/site_perl/5.14.2
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl 5.15.3:
    HOME=/storage/asg
    LANG=en_US.UTF-8
    LANGUAGE=
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/storage/asg/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin
  PERL_BADLANG (unset)
    SHELL=/bin/bash



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic