Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHECK routine called after syntax error #2129

Closed
p5pRT opened this issue Jun 26, 2000 · 13 comments
Closed

CHECK routine called after syntax error #2129

p5pRT opened this issue Jun 26, 2000 · 13 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 26, 2000

Migrated from rt.perl.org#3422 (status was 'resolved')

Searchable as RT3422$

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2000

From mjtg@cus.cam.ac.uk

Playing around with one of Barrie Slaymaker's bits of code, I tried

perl5.6.0 -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"), @​bar'

and got

Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
unexpected OP_GREPSTART at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 636
  B​::Deparse​::pp_grepstart('B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d498)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
  B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)', 'B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d498)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1634
  B​::Deparse​::pp_list('B​::Deparse=HASH(0xea960)', 'B​::Deparse=HASH(0xea960)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1810
  B​::Deparse​::pp_null('B​::Deparse=HASH(0xea960)', 'B​::Deparse=HASH(0xea960)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
  B​::Deparse​::deparse(undef, 'B​::Deparse=HASH(0xea960)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1239
  B​::Deparse​::deparse_binop_right('B​::Deparse=HASH(0xea960)', 'B​::BINOP=SCALAR(0x29c9fc)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1257
  B​::Deparse​::binop('B​::Deparse=HASH(0xea960)', 'B​::BINOP=SCALAR(0x29c9fc)', 6, '=', 7, 1) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1303
  B​::Deparse​::pp_aassign('B​::Deparse=HASH(0xea960)', 'B​::BINOP=SCALAR(0x29c9fc)', 6) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
  B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)', 'B​::BINOP=SCALAR(0x29c9fc)', 6) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1646
  B​::Deparse​::pp_list('B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d9f0)', 0) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
  B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)', 'B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d9f0)', 0) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 706
  B​::Deparse​::pp_leave('B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x177a5c)', 0) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
  B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x177a5c)', 0) called at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line 375
  B​::Deparse​::__ANON__() called at (eval 4) line 1
  O​::CHECK() called at -e line 1
  require 0 called at -e line 1
@​x = XXX, @​bar;

The syntax error is of course correct (though it makes me wonder if the
"if it looks like a function ... " rule isn't overagressive sometimes).

But the rest of the junk suggests that perhaps CHECK routines shouldn't
be called after syntax errors.

Mike Guy

% perl5.6.0 -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration​:
  Platform​:
  osname=solaris, osvers=2.6, archname=sun4-solaris
  uname=''
  config_args='-dOes -f confug.sh'
  hint=previous, 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='gcc', optimize='-O', gccversion=2.7.2.3
  cppflags='-I/usr/local/include -I/opt/local/include -DREG_INFTY=22786'
  ccflags ='-I/usr/local/include -I/opt/local/include -DREG_INFTY=22786'
  stdchar='unsigned 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=4
  alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
  libpth=/usr/local/lib /opt/local/lib /lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
  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/opt/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: USE_LARGE_FILES
  Locally applied patches​:
  diag.format
  perldoc.vers
  installman.opt
  undef.opcode
  Built under solaris
  Compiled at Apr 4 2000 17​:17​:26
  @​INC​:
  /home/mjtg/perl5.6.0/lib
  /home/mjtg/perl5.6.0/lib
  /home/mjtg/perl5.6.0/lib
  /home/mjtg/perl5.6.0/lib
  .

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2000

From [Unknown Contact. See original ticket]

"M.J.T. Guy" wrote​:

Playing around with one of Barrie Slaymaker's bits of code, I tried

perl5.6.0 -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"), @​bar'

and got

Not enough arguments for grep at -e line 1, near ""fooba")"

I trip over that, too.

But the rest of the junk suggests that perhaps CHECK routines shouldn't
be called after syntax errors.

Not sure if this is related, but the CHECK bit rang a bell.

[barries@​jester /tmp]$ perl -w -MO=Deparse -MBenchmark -e 1
Exiting subroutine via next at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
Exiting subroutine via next at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
Can't call method "sibling" on an undefined value at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
CHECK failed--call queue aborted.

- Barrie

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2000

From [Unknown Contact. See original ticket]

Barrie Slaymaker (lists.p5p)​:

[barries@​jester /tmp]$ perl -w -MO=Deparse -MBenchmark -e 1

Fixed in cfgperl.

perl5.6.0 -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"), @​bar'

Not fixed in cfgperl.

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2000

From [Unknown Contact. See original ticket]

Barrie Slaymaker <barries@​slaysys.com> wrote

[barries@​jester /tmp]$ perl -w -MO=Deparse -MBenchmark -e 1
Exiting subroutine via next at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
Exiting subroutine via next at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
Can't call method "sibling" on an undefined value at /usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
CHECK failed--call queue aborted.

That's mended in perl-current, so is a different problem from my example.

Tho' I note in passing that it deparses the whole of Benchmark.pm,
rather than just '1' as I would have expected. Is that doing the
Right Thing?

Mike Guy

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 2004

From @smpeters

[mjtg@​cus.cam.ac.uk - Mon Jun 26 00​:48​:22 2000]​:

Playing around with one of Barrie Slaymaker's bits of code, I tried

perl5.6.0 -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq
"fooba"), @​bar'

and got

Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
unexpected OP_GREPSTART at /home/mjtg/perl5.6.0/lib/B/Deparse.pm line
636
B​::Deparse​::pp_grepstart('B​::Deparse=HASH(0xea960)',
'B​::LISTOP=SCALAR(0x16d498)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)',
'B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d498)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1634
B​::Deparse​::pp_list('B​::Deparse=HASH(0xea960)',
'B​::Deparse=HASH(0xea960)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1810
B​::Deparse​::pp_null('B​::Deparse=HASH(0xea960)',
'B​::Deparse=HASH(0xea960)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
B​::Deparse​::deparse(undef, 'B​::Deparse=HASH(0xea960)',
'B​::UNOP=SCALAR(0x16d954)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1239
B​::Deparse​::deparse_binop_right('B​::Deparse=HASH(0xea960)',
'B​::BINOP=SCALAR(0x29c9fc)', 'B​::UNOP=SCALAR(0x16d954)', 7) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1257
B​::Deparse​::binop('B​::Deparse=HASH(0xea960)',
'B​::BINOP=SCALAR(0x29c9fc)', 6, '=', 7, 1) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1303
B​::Deparse​::pp_aassign('B​::Deparse=HASH(0xea960)',
'B​::BINOP=SCALAR(0x29c9fc)', 6) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)',
'B​::BINOP=SCALAR(0x29c9fc)', 6) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 1646
B​::Deparse​::pp_list('B​::Deparse=HASH(0xea960)',
'B​::LISTOP=SCALAR(0x16d9f0)', 0) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)',
'B​::Deparse=HASH(0xea960)', 'B​::LISTOP=SCALAR(0x16d9f0)', 0) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 706
B​::Deparse​::pp_leave('B​::Deparse=HASH(0xea960)',
'B​::LISTOP=SCALAR(0x177a5c)', 0) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 398
B​::Deparse​::deparse('B​::Deparse=HASH(0xea960)',
'B​::LISTOP=SCALAR(0x177a5c)', 0) called at
/home/mjtg/perl5.6.0/lib/B/Deparse.pm line 375
B​::Deparse​::__ANON__() called at (eval 4) line 1
O​::CHECK() called at -e line 1
require 0 called at -e line 1
@​x = XXX, @​bar;

The syntax error is of course correct (though it makes me wonder if
the
"if it looks like a function ... " rule isn't overagressive
sometimes).

But the rest of the junk suggests that perhaps CHECK routines
shouldn't
be called after syntax errors.

Mike Guy

This appears to have been fixed at some point in the past.

perl -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"), @​bar'
Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
BEGIN { $^W = 1; }
unexpected OP_GREPSTART at
/usr/libdata/perl5/i386-openbsd/5.8.5/B/Deparse.pm line 1068.
@​x = XXX, @​bar;

@p5pRT
Copy link
Author

p5pRT commented Nov 21, 2004

@smpeters - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented Nov 22, 2004

From mjtg@cam.ac.uk

"Steve Peters wrote

This appears to have been fixed at some point in the past.

perl -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"), @​bar'
Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
BEGIN { $^W = 1; }
unexpected OP_GREPSTART at
/usr/libdata/perl5/i386-openbsd/5.8.5/B/Deparse.pm line 1068.
@​x = XXX, @​bar;

It's been changed, but it hasn't been fixed - where do you think that
"unexpected OP_GREPSTART" is coming from if it's not the CHECK routine?

This bug should be re-opened.

Mike Guy

@p5pRT
Copy link
Author

p5pRT commented Nov 22, 2004

@smpeters - Status changed from 'resolved' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 22, 2004

From @smpeters

[mjtg@​cam.ac.uk - Mon Nov 22 10​:18​:24 2004]​:

"Steve Peters wrote

This appears to have been fixed at some point in the past.

perl -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"),
@​bar'
Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
BEGIN { $^W = 1; }
unexpected OP_GREPSTART at
/usr/libdata/perl5/i386-openbsd/5.8.5/B/Deparse.pm line 1068.
@​x = XXX, @​bar;

It's been changed, but it hasn't been fixed - where do you think
that
"unexpected OP_GREPSTART" is coming from if it's not the CHECK
routine?

This bug should be re-opened.
Reopened. :)

I attemted to reattempt to recreate the problem and found that it only
complains loudly after adding a "-d". I also found that map() has a
similar problem.

bash-2.05b$ perl -d -MO=Deparse -e'grep '

Loading DB routines from perl5db.pl version 1.27
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Not enough arguments for grep at -e line 1, at EOF
-e had compilation errors.
at -e line 1
unexpected OP_GREPSTART at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse.pm line 1068.
at /usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse.pm line 1068
  B​::Deparse​::AUTOLOAD('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR(0xa
54ceb4)', 0.5) called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Depars
e.pm line 791
  B​::Deparse​::deparse('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR(0xa5
4ceb4)', 0.5) called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse
.pm line 1205
  B​::Deparse​::deparse_root('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR
(0xa54d510)') called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse
.pm line 649
 
B​::Deparse​::__ANON__[/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/De
parse.pm​:667]() called at (eval
4)[/usr/lib/perl5/5.8.5/cygwin-thread-multi-64in
t/O.pm​:22] line 31
  O​::CHECK() called at -e line 1
  eval {...} called at -e line 1
XXX;
bash-2.05b$ perl -d -MO=Deparse -e'map '

Loading DB routines from perl5db.pl version 1.27
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Not enough arguments for map at -e line 1, at EOF
-e had compilation errors.
at -e line 1
unexpected OP_MAPSTART at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Depar
se.pm line 1068.
at /usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse.pm line 1068
  B​::Deparse​::AUTOLOAD('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR(0xa
54ceb4)', 0.5) called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Depars
e.pm line 791
  B​::Deparse​::deparse('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR(0xa5
4ceb4)', 0.5) called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse
.pm line 1205
  B​::Deparse​::deparse_root('B​::Deparse=HASH(0xa3f0684)',
'B​::LISTOP=SCALAR
(0xa54d510)') called at
/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/Deparse
.pm line 649
 
B​::Deparse​::__ANON__[/usr/lib/perl5/5.8.5/cygwin-thread-multi-64int/B/De
parse.pm​:667]() called at (eval
4)[/usr/lib/perl5/5.8.5/cygwin-thread-multi-64in
t/O.pm​:22] line 31
  O​::CHECK() called at -e line 1
  eval {...} called at -e line 1
XXX;

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2004

From @smpeters

[stmpeters - Mon Nov 22 12​:25​:14 2004]​:

[mjtg@​cam.ac.uk - Mon Nov 22 10​:18​:24 2004]​:

"Steve Peters wrote

This appears to have been fixed at some point in the past.

perl -w -MO=Deparse -e '@​x = grep (substr( $_, 0, 5 ) eq "fooba"),
@​bar'
Not enough arguments for grep at -e line 1, near ""fooba")"
-e had compilation errors.
BEGIN { $^W = 1; }
unexpected OP_GREPSTART at
/usr/libdata/perl5/i386-openbsd/5.8.5/B/Deparse.pm line 1068.
@​x = XXX, @​bar;

It's been changed, but it hasn't been fixed - where do you think
that
"unexpected OP_GREPSTART" is coming from if it's not the CHECK
routine?

This bug should be re-opened.
Reopened. :)

I attemted to reattempt to recreate the problem and found that it only
complains loudly after adding a "-d". I also found that map() has a
similar problem.

bash-2.05b$ perl -d -MO=Deparse -e'grep '
<snip>

The error was caused by pp_grepstart() and pp_mapstart() not being
implemented in B​::Deparse. This caused the errors generated by
B​::Deparse​::AUTOLOAD() to be generated. The attached patch fixes this bug.

The patch was built from blead-23523. All tests were successful.

It also behaves as other built-in functions do.

./perl -Ilib -d -MO=Deparse -e'rindex'

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Not enough arguments for rindex at -e line 1, at EOF
-e had compilation errors.
at -e line 1
rindex;

./perl -Ilib -d -MO=Deparse -e'grep'

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Not enough arguments for grep at -e line 1, at EOF
-e had compilation errors.
at -e line 1
grep;

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2004

From @smpeters

B_Deparse_grepstart.patch
--- ext/B/B/Deparse.pm.orig	Mon Nov 22 15:10:30 2004
+++ ext/B/B/Deparse.pm	Mon Nov 22 15:12:35 2004
@@ -2366,6 +2366,8 @@
 
 sub pp_mapwhile { mapop(@_, "map") }
 sub pp_grepwhile { mapop(@_, "grep") }
+sub pp_mapstart { baseop(@_, "map") }
+sub pp_grepstart { baseop(@_, "grep") }
 
 sub pp_list {
     my $self = shift;

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2004

From @rgs

Steve Peters via RT wrote​:

The error was caused by pp_grepstart() and pp_mapstart() not being
implemented in B​::Deparse. This caused the errors generated by
B​::Deparse​::AUTOLOAD() to be generated. The attached patch fixes this bug.

Thanks, applied as #23526.

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 2004

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant