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

[perl #81424] B::Deparse omits a regex match in its output

From:
Moritz Lenz
Date:
December 28, 2010 22:35
Subject:
[perl #81424] B::Deparse omits a regex match in its output
Message ID:
rt-3.6.HEAD-5425-1293604019-1217.81424-75-0@perl.org
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #81424]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81424 >


This is a bug report for perl from moritz@faui2k3.org,
generated with the help of perlbug 1.39 running under perl 5.12.1.


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

perl -MO=Deparse -ce 'my @s = qw/ a b c/; print m/$s[1]/'
my(@s) = ('a', 'b', 'c');
print $s[1];
-e syntax OK

You can see that m/$s[1]/ comes out as simply $s[1] - which is wrong,
because
$s[1] is 'b', whereas undef ~~ /b/ is false (or '').

Inspecting the same program with B::Concise clearly shows a match() call, so
it's a bug in B::Deparse (or one of its dependencies), not a misparse

perl -MO=Concise -ce 'my @s = qw/ a b c/; print m/$s[1]/'
h  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
9     <2> aassign[t2] vKS ->a
-        <1> ex-list lKP ->7
3           <0> pushmark s ->4
4           <$> const(PV "a") s ->5
5           <$> const(PV "b") s ->6
6           <$> const(PV "c") s ->7
-        <1> ex-list lK ->9
7           <0> pushmark s ->8
8           <0> padav[@s:1,2] lRM*/LVINTRO ->9
a     <;> nextstate(main 2 -e:1) v:{ ->b
g     <@> print vK ->h
b        <0> pushmark s ->c
f        </> match() lK/RTIME ->g
e           <|> regcomp(other->f) sK/1 ->f
c              <1> regcreset sK/1 ->d
-                 <1> ex-aelem sK/2 ->e
d                    <0> aelemfast[@s:1,2] sR*/1 ->e
-                    <0> ex-const s ->-
-e syntax OK

perl 5.10.1 and its accompanying B::Deparse produce the same erroneous
output.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
    module=B::Deparse
---
Site configuration information for perl 5.12.1:

Configured by moritz at Sun Oct  3 20:56:58 CEST 2010.

Summary of my perl5 (revision 5 version 12 subversion 1) configuration:

  Platform:
    osname=linux, osvers=2.6.32-5-686, archname=i686-linux
    uname='linux trudi 2.6.32-5-686 #1 smp sat sep 18 02:14:45 utc 2010
i686 gnulinux '
    config_args='-de -Dprefix=/home/moritz/perl5//perls/perl-5.12.1'
    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.4.5 20100728 (prerelease)', 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 /usr/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.11.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.11.2'
  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.12.1:
    /home/moritz/cpan/lib
    /home/moritz/perl5//perls/perl-5.12.1/lib/site_perl/5.12.1/i686-linux
    /home/moritz/perl5//perls/perl-5.12.1/lib/site_perl/5.12.1
    /home/moritz/perl5//perls/perl-5.12.1/lib/5.12.1/i686-linux
    /home/moritz/perl5//perls/perl-5.12.1/lib/5.12.1
    .

---
Environment for perl 5.12.1:
    HOME=/home/moritz
    LANG=en_US.UTF-8
    LANGUAGE=C
    LC_CTYPE=de_DE.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=/home/moritz/perl5//bin:/home/moritz/perl5//perls/current/bin:/bin:/sbin:/usr/bin:/usr/sbin:/home/moritz/bin:/usr/games:/usr/bin/X11:/usr/local/bin:/home/moritz/rakudo/parrot_install/bin
    PERL5LIB=/home/moritz/cpan/lib
    PERLBREW_ROOT=/home/moritz/perl5/
    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