Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #70201] Deparse fails with attributes

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Nov 3, 2009, 12:49 PM

Post #1 of 2 (60 views)
Permalink
[perl #70201] Deparse fails with attributes

# New Ticket Created by Nicholas Clark
# Please include the string: [perl #70201]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=70201 >



This is a bug report for perl from nick[at]ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.11.1.


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

$ ./perl -Ilib -MO=Deparse -e 'our $pi :shared = 4'
use attributes ('main', \undef, 'shared');
our $pi = 4;
-e syntax OK


That, I think is a bug. It's not going to have the same results as the code
that was passed in.

I have no idea how to fix this.

Nicholas Clark

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

Configured by nick at Sun Nov 1 19:26:47 GMT 2009.

Summary of my perl5 (revision 5 version 11 subversion 1) configuration:
Commit id: c9de86d555b2cc844acfe134ffe61228163a50ea
Platform:
osname=linux, osvers=2.6.18-xenu, archname=x86_64-linux
uname='linux zazen 2.6.18-xenu #1 smp thu oct 4 12:23:41 bst 2007 x86_64 gnulinux '
config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick[at]ccl4.org -Dperladmin=nick[at]ccl4.org -Dinc_version_list= -Dinc_version_list_init=0 -Doptimize=-g -Uusethreads -Uuse64bitall -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/5110 -Uusevendorprefix -Uvendorprefix=~/Sandpit/snap5.9.x-v5.11.1-104-gc9de86d -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -Uusesitecustomize -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.11.1:
lib
/home/nick/Sandpit/5110/lib/perl5/site_perl/5.11.1/x86_64-linux
/home/nick/Sandpit/5110/lib/perl5/site_perl/5.11.1
/home/nick/Sandpit/5110/lib/perl5/5.11.1/x86_64-linux
/home/nick/Sandpit/5110/lib/perl5/5.11.1
.

---
Environment for perl 5.11.1:
HOME=/home/nick
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/nick/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/sbin:/usr/sbin
PERL_BADLANG (unset)
SHELL=/bin/bash


zefram at fysh

Nov 3, 2009, 11:16 PM

Post #2 of 2 (50 views)
Permalink
Re: [perl #70201] Deparse fails with attributes [In reply to]

Nicholas Clark wrote:
>use attributes ('main', \undef, 'shared');

The op tree behind this is:

12 <;> nextstate(main 1 -e:1) :{ ->13
19 <1> entersub[t1] KS*/TARG ->1a
13 <0> pushmark s ->14
14 <$> const[PV "attributes"] sM ->15
15 <$> const[PV "main"] sM ->16
16 <$> const[RV \] sM ->17
17 <$> const[PV "shared"] sM ->18
18 <$> method_named[PV "import"] ->19

As you see, $pi is referenced by an op_const containing an RV. There's
no clean way to get from the RV to the name "$pi". You could perhaps
have Deparse search through all known packages, looking for a matching
variable, but that sounds slow and will still fail to find the target
in some similar cases.

I reckon it's unfixable: an inherent limitation of deparsing.

-zefram

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.