Front page | perl.perl5.porters |
Postings from March 2001
B::Deparse precedence bug. (Patch included.)
Thread Next
From:
Jeremy Madea
Date:
March 29, 2001 12:05
Subject:
B::Deparse precedence bug. (Patch included.)
Message ID:
20010329120502.A24881@dr.inktomi.com
I sent the following bug report to perlbug over a week ago. I don't
believe it ever made it to p5p. The bug is in B::Deparse. It doesn't
always properly parenthesize negative literals when it should. Here
is the original report with a very small patch:
----- Forwarded message from Jeremy Madea <jmadea@inktomi.com> -----
Date: Mon, 19 Mar 2001 16:14:37 -0800
From: Jeremy Madea <jmadea@inktomi.com>
To: perlbug@perl.org
Subject: B::Deparse precedence bug. (Patch included.)
Reply-To: jmadea@inktomi.com
User-Agent: Mutt/1.2.5i
This is a bug report for perl from jmadea@inktomi.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.
-----------------------------------------------------------------
[Please enter your report here]
### The following should make the problem obvious.
101,0 jmadea@dr:~$ perl -le 'print( -1 ** $a )'
-1
102,0 jmadea@dr:~$ perl -le 'print( (-1) ** $a )'
1
103,0 jmadea@dr:~$ perl -MO=Deparse -e 'print( (-1) ** $a )'
print -1 ** $a;
-e syntax OK
### Two quick tests made after patching...
104,0 jmadea@dr:~$ perl -MO=Deparse -e 'print( (-1) ** $a )'
print((-1) ** $a);
-e syntax OK
105,0 jmadea@dr:~$ perl -MO=Deparse -e 'print( -1 ** $a )'
print -1 ** $a;
-e syntax OK
### Text of patch for Deparse.pm
2384c2384,2386
< return const($sv);
---
> # return const($sv);
> my $c = const $sv;
> return $c < 0 ? $self->maybe_parens($c, $cx, 21) : $c;
--
Jeremy Madea Inktomi Corporation http://www.inktomi.com/
jmadea@inktomi.com Search/Custom Cluster Administrator
work: 650.653.6970 ``My two cents aren't worth a dime.''
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=low
---
Site configuration information for perl v5.6.0:
Configured by sauoq at Mon Oct 30 19:03:21 PST 2000.
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris
uname='sunos dr 5.7 generic_106541-02 sun4u sparc sunw,ultra-5_10 '
config_args='-ds -e -Dprefix=/usr/local/ -Dcc='/usr/gnu/bin/gcc''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='/usr/gnu/bin/gcc', optimize='-O', gccversion=2.95 19990728 (release)
cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/gnu/include'
ccflags ='-fno-strict-aliasing -I/usr/local/include -I/usr/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='/usr/gnu/bin/gcc', ldflags =' -L/usr/local/lib -L/usr/gnu/lib '
libpth=/usr/local/lib /usr/gnu/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec -liconv
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -L/usr/gnu/lib'
Locally applied patches:
---
@INC for perl v5.6.0:
/usr/local//lib/perl5/5.6.0/sun4-solaris
/usr/local//lib/perl5/5.6.0
/usr/local//lib/perl5/site_perl/5.6.0/sun4-solaris
/usr/local//lib/perl5/site_perl/5.6.0
/usr/local//lib/perl5/site_perl
.
---
Environment for perl v5.6.0:
HOME=/home/jmadea
LANG=en_US
LANGUAGE (unset)
LC_ALL=C
LC_CTYPE=C
LD_LIBRARY_PATH=/usr/local/lib:/usr/gnu/lib
LOGDIR (unset)
PATH=/home/jmadea/bin:/usr/gnu/bin:/usr/openwin/bin:/bin:/usr/bin:/usr/sbin:/usr/X/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/ucb:/usr/dt/bin:/usr/ccs/bin:/etc:/usr/local/netscape
PERL_BADLANG (unset)
SHELL=/bin/bash
----- End forwarded message -----
--
Jeremy Madea Inktomi Corporation http://www.inktomi.com/
jmadea@inktomi.com Search/Custom Cluster Administrator
work: 650.653.6970 ``My two cents aren't worth a dime.''
Thread Next
-
B::Deparse precedence bug. (Patch included.)
by Jeremy Madea