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

[perl #74740] Deparse can turn negated function call -(f()) to filetest -f()

From:
Zsban Ambrus
Date:
April 29, 2010 05:16
Subject:
[perl #74740] Deparse can turn negated function call -(f()) to filetest -f()
Message ID:
rt-3.6.HEAD-6227-1272463364-1330.74740-75-0@perl.org
# New Ticket Created by  Zsban Ambrus 
# Please include the string:  [perl #74740]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=74740 >


This is a bug report for perl from ambrus@math.bme.hu,
generated with the help of perlbug 1.39 running under perl 5.12.0.


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


The following shows B::Deparse deparsing some code wrong.  The original
has -(f('bar')), which is negation applied to the call of the user sub f.
On the other hand, the deparsed code won't work (will print "Warning:
something's wrong at - line 4."), for it has -f('bar') which is a
filetest call.

$ perl -e "sub f { 'foo' } warn(-(f('bar')));"
-foo at -e line 1.
$ perl -MO=Deparse,-p -e "sub f { 'foo' } warn(-(f('bar')));"
sub f {
    'foo';
}
warn((-f('bar')));
-e syntax OK
$


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

Configured by ambrus at Tue Apr 13 11:36:19 CEST 2010.

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

  Platform:
    osname=linux, osvers=2.6.33, archname=x86_64-linux
    uname='linux king 2.6.33 #1 smp sat mar 6 20:03:56 cet 2010 x86_64
gnulinux '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', 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.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 /usr/local/lib64
    libs=-lnsl -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 -O2 -L/usr/local/lib
-fstack-protector'

Locally applied patches:


---
@INC for perl 5.12.0:
    /usr/local/lib/perl5/site_perl/5.12.0/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.12.0
    /usr/local/lib/perl5/5.12.0/x86_64-linux
    /usr/local/lib/perl5/5.12.0
    .

---
Environment for perl 5.12.0:
    HOME=/home/ambrus
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=hu_HU
    LD_LIBRARY_PATH=/home/ambrus/local/lib/
    LOGDIR (unset)
    PATH=/home/ambrus/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/usr/local/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