Skip Menu |
Report information
Id: 74114
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: frank.wiegand <frank.wiegand [at] gmail.com>
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: High
Type:
  • core
  • CoreDump
  • parsing
Perl Version: 5.12.0
Fixed In:
  • 5.12.1
  • 5.13.0



Subject: when(scalar){} -> S_looks_like_bool: Assertion `o' failed.
Date: Wed, 07 Apr 2010 13:36:19 +0200
To: perlbug <perlbug [...] perl.org>
From: Frank Wiegand <frank.wiegand [...] gmail.com>
Download (untitled) / with headers
text/plain 3.9k
This is a bug report for perl from frank.wiegand@gmail.com, generated with the help of perlbug 1.39 running under perl 5.12.0. ----------------------------------------------------------------- % perl-5.10.1 -E 'when(scalar){}' Not enough arguments for scalar at -e line 1, near "scalar)" Execution of -e aborted due to compilation errors. % perl-5.12.0-RC3 -E 'when(scalar){}' perl-5.12.0-RC3: op.c:5272: S_looks_like_bool: Assertion `o' failed. Aborted This regression has been introduced by the following commit (as git bisect says): 5341b2b7ab11bc31f63ac7a675e74106418d0661 is the first bad commit commit 5341b2b7ab11bc31f63ac7a675e74106418d0661 Author: Josh ben Jore <jjore@cpan.org> Date: Wed Sep 23 15:35:14 2009 -0700 Fix when( scalar ... ) bug looks_like_bool should look past scalar(). Prior to this fix, saying scalar() caused the when() argument to be /not/ a boolean even if it reasonably was. Perhaps something like: when( scalar /$re/ ). I don't know any natural way someone is doing to use when(scalar ...) but it certainly seems like it was mistakenly left out. :100644 100644 729c25f0aa87bcd25f8606bd70d852c6c67e1967 c3736fac0b76b2e4beaf755d5a628d4d71e129d3 M op.c :040000 040000 afe81091570f36d8e50f3513ec91f3f0f27b55f4 03acff2025d490e42f74d28599f1df3994becef1 M t Thanks, Frank ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.12.0: Configured by fw at Sat Apr 3 09:18:00 CEST 2010. Summary of my perl5 (revision 5 version 12 subversion 0) configuration: Platform: osname=linux, osvers=2.6.32-trunk-amd64, archname=x86_64-linux uname='linux hal2 2.6.32-trunk-amd64 #1 smp sun jan 10 22:40:40 utc 2010 x86_64 gnulinux ' config_args='-de -Dusedevel -DDEBUGGING=both -Doptimize=-g -Dcc=ccache gcc -Dld=gcc -Dprefix=/opt/perl/perl-5.12.0-RC3/ -Dmad' 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='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.4.3 20100108 (prerelease)', 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 -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.10.2.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.10.2' 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: RC3 --- @INC for perl 5.12.0: /opt/perl/perl-5.12.0-RC3/lib/site_perl/5.12.0/x86_64-linux /opt/perl/perl-5.12.0-RC3/lib/site_perl/5.12.0 /opt/perl/perl-5.12.0-RC3/lib/5.12.0/x86_64-linux /opt/perl/perl-5.12.0-RC3/lib/5.12.0 . --- Environment for perl 5.12.0: HOME=/home/fw LANG=de_DE.UTF-8 LANGUAGE= LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/sbin:/usr/sbin:/home/fw/bin:/home/fw/bin:/usr/local/bin:/usr/bin:/bin:/usr/games PERL_AUTOINSTALL=--defaultdeps PERL_BADLANG (unset) PERL_EXTUTILS_AUTOINSTALL=--defaultdeps PERL_MM_USE_DEFAULT=1 SHELL=/bin/zsh
Subject: Re: [perl #74114] when(scalar){} -> S_looks_like_bool: Assertion `o' failed.
Date: Fri, 9 Apr 2010 12:25:17 +0200
To: perl5-porters [...] perl.org
From: Rafael Garcia-Suarez <rgs [...] consttype.org>
Download (untitled) / with headers
text/plain 1010b
On 7 April 2010 13:36, Frank Wiegand <perlbug-followup@perl.org> wrote: Show quoted text
>  % perl-5.10.1 -E 'when(scalar){}' >  Not enough arguments for scalar at -e line 1, near "scalar)" >  Execution of -e aborted due to compilation errors. > >  % perl-5.12.0-RC3 -E 'when(scalar){}' >  perl-5.12.0-RC3: op.c:5272: S_looks_like_bool: Assertion `o' failed. >  Aborted
Thanks for the report and the bisect ! Here's a patch that makes it report a syntax error instead. I'll apply to maint 5.12 when opened. diff --git a/op.c b/op.c index 9c94cc8..76eb16f 100644 --- a/op.c +++ b/op.c @@ -5282,14 +5282,11 @@ S_looks_like_bool(pTHX_ const OP *o) && looks_like_bool(cLOGOPo->op_first->op_sibling)); case OP_NULL: + case OP_SCALAR: return ( o->op_flags & OPf_KIDS && looks_like_bool(cUNOPo->op_first)); - case OP_SCALAR: - return looks_like_bool(cUNOPo->op_first); - - case OP_ENTERSUB: case OP_NOT: case OP_XOR:
Download (untitled) / with headers
text/plain 1.1k
On Fri Apr 09 03:25:49 2010, rgs@consttype.org wrote: Show quoted text
> On 7 April 2010 13:36, Frank Wiegand <perlbug-followup@perl.org> wrote:
> >  % perl-5.10.1 -E 'when(scalar){}' > >  Not enough arguments for scalar at -e line 1, near "scalar)" > >  Execution of -e aborted due to compilation errors. > > > >  % perl-5.12.0-RC3 -E 'when(scalar){}' > >  perl-5.12.0-RC3: op.c:5272: S_looks_like_bool: Assertion `o' failed. > >  Aborted
> > Thanks for the report and the bisect ! > > Here's a patch that makes it report a syntax error instead. I'll apply > to maint 5.12 when opened. >
rgs - wanna cherrypick this to maint? Show quoted text
> diff --git a/op.c b/op.c > index 9c94cc8..76eb16f 100644 > --- a/op.c > +++ b/op.c > @@ -5282,14 +5282,11 @@ S_looks_like_bool(pTHX_ const OP *o) > && looks_like_bool(cLOGOPo->op_first->op_sibling)); > > case OP_NULL: > + case OP_SCALAR: > return ( > o->op_flags & OPf_KIDS > && looks_like_bool(cUNOPo->op_first)); > > - case OP_SCALAR: > - return looks_like_bool(cUNOPo->op_first); > - > - > case OP_ENTERSUB: > > case OP_NOT: case OP_XOR: >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org