# New Ticket Created by josh lik.nonet
# Please include the string: [perl #46429]
# in the subject line of all future correspondence about
this issue.
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=46429 >
This is a bug report for perl from josh lik.nonet,
generated with the help of perlbug 1.36 running under perl
5.10.0.
------------------------------------------------------------
-----
[Please enter your report here]
The following code should not use smartmatch but it does.
use feature ':5.10';
given ($_) {
when ( /(.)/ and 1 == $1 ) {
say 'yes';
}
}
When smartmatch is used, the boolean result is used as the
parameter
against $_. I produced the following patch which fixes this
case but
breaks another. It becomes a choice between the new test and
the old
now failing case. For now, I'm just reporting this. I need
to jot down
the other bugs today before I forget.
not ok 54 - ((1 == $ok) || "foo") not
smartmatched
# Failed test '((1 == $ok) || "foo") not
smartmatched'
# at op/switch.t line 519.
--- bleadperl/op.c 2007-10-12 08:23:57.000000000 -0700
+++ myblead/op.c 2007-10-14 09:53:34.000000000 -0700
 -4937,6
+4937,11 
looks_like_bool(cLOGOPo->op_first)
&&
looks_like_bool(cLOGOPo->op_first->op_sibling));
+ case OP_NULL:
+ return (
+ o->op_flags & OPf_KIDS
+ &&
looks_like_bool(cUNOPo->op_first));
+
case OP_ENTERSUB:
case OP_NOT: case OP_XOR:
--- bleadperl/t/op/switch.t 2006-06-13
12:29:33.000000000 -0700
+++ myblead2/t/op/switch.t 2007-10-14
10:37:24.000000000 -0700
 -457,6
+457,16 
# Other things that should not be smart matched
{
my $ok = 0;
+ given(12) {
+ when( /(d+)/ and ( 1 <= $1 and $1 <= 12 ) )
{
+ $ok = 1;
+ }
+ }
+ ok($ok, "bool not smartmatches");
+}
+
+{
+ my $ok = 0;
given(0) {
when(eof(DATA)) {
$ok = 1;
[Please do not change anything below this line]
------------------------------------------------------------
-----
---
Flags:
category=core
severity=high
---
Site configuration information for perl 5.10.0:
Configured by josh at Sun Oct 14 09:55:17 PDT 2007.
Summary of my perl5 (revision 5 version 10 subversion 0
patch 32107) configuration:
Platform:
osname=linux, osvers=2.6.20-16-generic,
archname=i686-linux
uname='linux lik 2.6.20-16-generic #2 smp sun sep 23
19:50:39 utc 2007 i686 gnulinux '
config_args='-DEBUGGING=both
-Dprefix=/opt/perl-5.10.0-dbg -des'
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 ='-DDEBUGGING -fno-strict-aliasing
-pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-DDEBUGGING -fno-strict-aliasing -pipe
-I/usr/local/include'
ccversion='', gccversion='4.1.2 (Ubuntu
4.1.2-0ubuntu4)', 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 =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/lib64
libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.5.so, so=so, useshrplib=false,
libperl=libperl.a
gnulibc_version='2.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g
-L/usr/local/lib'
Locally applied patches:
DEVEL
---
INC
for perl 5.10.0:
/opt/perl-5.10.0-dbg/lib/5.10.0/i686-linux
/opt/perl-5.10.0-dbg/lib/5.10.0
/opt/perl-5.10.0-dbg/lib/site_perl/5.10.0/i686-linux
/opt/perl-5.10.0-dbg/lib/site_perl/5.10.0
.
---
Environment for perl 5.10.0:
HOME=/home/josh
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/josh/bin/perl/5.8.8/bin:/home/josh/bin:/home/josh
/bin/bin:/home/josh/bin/perl/5.8.8/bin:/home/josh/bin:/home/
josh/bin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/b
in:/sbin:/bin:/usr/games
PERL_BADLANG (unset)
SHELL=/bin/bash
|