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

bizarre constant mangling in 5.8.0 #5786

Closed
p5pRT opened this issue Jul 27, 2002 · 8 comments
Closed

bizarre constant mangling in 5.8.0 #5786

p5pRT opened this issue Jul 27, 2002 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 27, 2002

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

Searchable as RT15654$

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2002

From troc@netrus.net

Created by troc@eyrie.homenet

Tests for the POE 0.22 distribution (on the CPAN) have been working
fine with perl 5.6.1 for several weeks. They pass for perl 5.8.0, but
they generate a disturbing warning in the process​:

2) eyrie​:~/perl/poe% /usr/local/perl-580/bin/perl t/08_errors.t
1..59
ok 1
.....
ok 17
Argument ",----- SELECT BITS IN -----\n" isn't numeric in array \
  element at /home/troc/perl/poe/POE/Kernel.pm line 1798.
ok 18
......

This behavior has been verified with perl 5.8.0 on Linux, MacOS X, and
FreeBSD. The test program is t/08_errors.t, which can be run from the
distribution's tarball directory as​:

  perl580 -I. t/08_errors.t

The code that's failing is actually a few lines further than the
warning says. I've verified its position while looking through the
perl -Dt output (excerpt below).

POE​::Kernel
1807​: elsif ($time >= $kr_events[-1]->[ST_TIME]) {
1808​: push @​kr_events, $event_to_enqueue;
1809​: }

It turns out that ST_TIME is being overwritten with a constant value
from some unrelated code. In this case, from POE​::Kernel​::Select, at
around line 263. The constant string is not used anywhere else in the
program.

POE​::Kernel
252​: sub ST_TIME () { 5 } # $event_due_time,

POE​::Kernel​::Select
262​: if (TRACE_SELECT) {
263​: warn ",----- SELECT BITS IN -----\n";
264​: warn "| READ : ", unpack('b*', $kr_vectors[VEC_RD]), "\n";
265​: warn "| WRITE : ", unpack('b*', $kr_vectors[VEC_WR]), "\n";
266​: warn "| EXPEDITE​: ", unpack('b*', $kr_vectors[VEC_EX]), "\n";
267​: warn "`--------------------------\n";
268​: }

This bug seems closely related to the one reported in
http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-07/msg01138.html

Juicy -Dt output for 5.8.0​:

(POE/Kernel.pm​:1798) padav(@​kr_events)
(POE/Kernel.pm​:1798) not
(POE/Kernel.pm​:1798) cond_expr
(POE/Kernel.pm​:1798) padsv($time)
(POE/Kernel.pm​:1798) padav(@​kr_events)
(POE/Kernel.pm​:1798) const(PVNV(-1))
(POE/Kernel.pm​:1798) aelem
(POE/Kernel.pm​:1798) rv2av
(POE/Kernel.pm​:1798) const(PVIV(",----- SELECT BITS IN -----\12"\0))
(POE/Kernel.pm​:1798) aelem
Argument ",----- SELECT BITS IN -----\n" isn't numeric in array \
  element at POE/Kernel.pm line 1798.
(POE/Kernel.pm​:1798) ge
(POE/Kernel.pm​:1798) cond_expr
(POE/Kernel.pm​:1798) pushmark
(POE/Kernel.pm​:1798) padav(@​kr_events)
(POE/Kernel.pm​:1798) padsv($event_to_enqueue)
(POE/Kernel.pm​:1798) push
(POE/Kernel.pm​:1798) nextstate

And corresponding output from 5.6.1​:

(POE/Kernel.pm​:1798) padav[38]
(POE/Kernel.pm​:1798) not
(POE/Kernel.pm​:1798) cond_expr
(POE/Kernel.pm​:1798) padsv[7]
(POE/Kernel.pm​:1798) padav[39]
(POE/Kernel.pm​:1798) const(IV(-1))
(POE/Kernel.pm​:1798) aelem
(POE/Kernel.pm​:1798) rv2av
(POE/Kernel.pm​:1798) const(IV(5))
(POE/Kernel.pm​:1798) aelem
(POE/Kernel.pm​:1798) ge
(POE/Kernel.pm​:1798) cond_expr
(POE/Kernel.pm​:1798) null
(POE/Kernel.pm​:1798) pushmark
(POE/Kernel.pm​:1798) padav[39]
(POE/Kernel.pm​:1798) padsv[34]
(POE/Kernel.pm​:1798) push
(POE/Kernel.pm​:1798) scope
(POE/Kernel.pm​:1798) null
(POE/Kernel.pm​:1798) null
(POE/Kernel.pm​:1798) nextstate

-- Rocco Caputo / troc@​pobox.com / poe.perl.org / poe.sf.net

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.6.1:

Configured by troc at Mon Apr 16 12:13:07 EDT 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=freebsd, osvers=4.3-rc, archname=i386-freebsd
    uname='freebsd eyrie.homenet 4.3-rc freebsd 4.3-rc #0: wed apr 11 01:15:54 edt 2001 troc@eyrie.homenet:usrobjusrsrcsysrc20010411 i386 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include',
    optimize='-O2 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.3 [FreeBSD] 20010315 (release)', 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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -lc -lcrypt -liconv -lutil
    perllibs=-lm -lc -lcrypt -liconv -lutil
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-shared  -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.1:
    /home/troc/perl/poe
    /usr/local/perl-561-single/lib/i386-freebsd
    /usr/local/perl-561-single/lib
    /usr/local/perl-561-single/site-lib/i386-freebsd
    /usr/local/perl-561-single/site-lib
    /usr/local/perl-561-single/site-lib
    .


Environment for perl v5.6.1:
    HOME=/home/troc
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/X11R6/bin:/home/troc/bin:/usr/local/xt
    PERL5LIB=/home/troc/perl/poe
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 2002

From troc@netrus.net

Whoops! perlbug on my system is still from 5.6.1. Here's -V from
perl 5.8.0.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration​:
  Platform​:
  osname=freebsd, osvers=4.6-stable, archname=i386-freebsd-thread-multi
  uname='freebsd eyrie.homenet 4.6-stable freebsd 4.6-stable #0​: wed jul 10 17​:26​:59 edt 2002 troc@​eyrie.homenet​:usrobjusrsrcsysrc20020709 i386 '
  config_args='-A define​:optimize=-O2 -g -pipe -A define​:prefix=/usr/local/perl-580 -A define​:privlib=/usr/local/perl-580/lib -A define​:sitelib=/usr/local/perl-580/site-lib -A define​:installusrbinperl=n -A define​:cf_email=troc@​pobox.com -A define​:versiononly=n -D usereentrant -D usethreads -D useithreads -D MULTIPLICITY -D DEBUGGING -des'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -I/usr/local/include',
  optimize='-O2 -g -pipe',
  cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
  ccversion='', gccversion='2.95.4 20020320 [FreeBSD]', 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 ='-pthread -Wl,-E -L/usr/local/lib'
  libpth=/usr/lib /usr/local/lib
  libs=-lgdbm -lm -lc_r -lcrypt -lutil
  perllibs=-lm -lc_r -lcrypt -lutil
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-DPIC -fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under freebsd
  Compiled at Jul 23 2002 19​:01​:19
  %ENV​:
  PERL5LIB="/home/troc/perl/poe"
  @​INC​:
  /home/troc/perl/poe
  /usr/local/perl-580/lib/i386-freebsd-thread-multi
  /usr/local/perl-580/lib
  /usr/local/perl-580/site-lib/i386-freebsd-thread-multi
  /usr/local/perl-580/site-lib
  /usr/local/perl-580/site-lib
  .

@p5pRT
Copy link
Author

p5pRT commented Aug 5, 2002

From @hvds

Rocco Caputo (via RT) <perlbug@​perl.org> wrote​:
:Tests for the POE 0.22 distribution (on the CPAN) have been working
:fine with perl 5.6.1 for several weeks. They pass for perl 5.8.0, but
:they generate a disturbing warning in the process​:
:
:2) eyrie​:~/perl/poe% /usr/local/perl-580/bin/perl t/08_errors.t
:1..59
:ok 1
:.......
:ok 17
:Argument ",----- SELECT BITS IN -----\n" isn't numeric in array \
: element at /home/troc/perl/poe/POE/Kernel.pm line 1798.
:ok 18
:........
:
:This behavior has been verified with perl 5.8.0 on Linux, MacOS X, and
:FreeBSD.

I can't reproduce this with POE-0.22 under Linux.

My config is below, in case it helps.

Hugo


Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration​:
  Platform​:
  osname=linux, osvers=2.4.2-2, archname=i686-linux
  uname='linux crypt.compulink.co.uk 2.4.2-2 #1 sun apr 8 20​:41​:30 edt 2001 i686 unknown '
  config_args='-des -Dprefix=/opt/perl-5.8.0 -Doptimize=-g -O6 -Dusedevel -Uversiononly'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef use5005threads=undef 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 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
  optimize='-g -O6',
  cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/include/gdbm'
  ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-81)', 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
  libs=-lnsl -lndbm -lgdbm -ldl -lm -lc -lcrypt -lutil
  perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
  libc=/lib/libc-2.2.2.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.2.2'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING USE_LARGE_FILES
  Built under linux
  Compiled at Jul 19 2002 15​:54​:15
  @​INC​:
  /opt/perl-5.8.0/lib/5.8.0/i686-linux
  /opt/perl-5.8.0/lib/5.8.0
  /opt/perl-5.8.0/lib/site_perl/5.8.0/i686-linux
  /opt/perl-5.8.0/lib/site_perl/5.8.0
  /opt/perl-5.8.0/lib/site_perl
  .

@p5pRT
Copy link
Author

p5pRT commented Aug 6, 2002

From troc@netrus.net

On Tue, Aug 06, 2002 at 12​:21​:53AM +0100, hv@​crypt.org wrote​:

Rocco Caputo (via RT) <perlbug@​perl.org> wrote​:
:Tests for the POE 0.22 distribution (on the CPAN) have been working
:fine with perl 5.6.1 for several weeks. They pass for perl 5.8.0, but
:they generate a disturbing warning in the process​:
:
:2) eyrie​:~/perl/poe% /usr/local/perl-580/bin/perl t/08_errors.t
:1..59
:ok 1
:.......
:ok 17
:Argument ",----- SELECT BITS IN -----\n" isn't numeric in array \
: element at /home/troc/perl/poe/POE/Kernel.pm line 1798.
:ok 18
:........
:
:This behavior has been verified with perl 5.8.0 on Linux, MacOS X, and
:FreeBSD.

I can't reproduce this with POE-0.22 under Linux.

My config is below, in case it helps.

[...]

usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef

[....]

It was discovered after I posted the report that the problem only
occurs with threads enabled. From my configuration​:

usethreads=define use5005threads=undef useithreads=define usemultiplicity=define

I also have usereentrant defined.

-- Rocco Caputo / troc@​pobox.com / poe.perl.org / poe.sf.net

@p5pRT
Copy link
Author

p5pRT commented Aug 6, 2002

From arthur@contiller.se

On tisdag, augusti 6, 2002, at 01​:21 , hv@​crypt.org wrote​:

Rocco Caputo (via RT) <perlbug@​perl.org> wrote​:
:Tests for the POE 0.22 distribution (on the CPAN) have been working
:fine with perl 5.6.1 for several weeks. They pass for perl 5.8.0, but
:they generate a disturbing warning in the process​:
:
:2) eyrie​:~/perl/poe% /usr/local/perl-580/bin/perl t/08_errors.t
:1..59
:ok 1
:.......
:ok 17
:Argument ",----- SELECT BITS IN -----\n" isn't numeric in array \
: element at /home/troc/perl/poe/POE/Kernel.pm line 1798.
:ok 18
:........
:
:This behavior has been verified with perl 5.8.0 on Linux, MacOS X, and
:FreeBSD.

I can't reproduce this with POE-0.22 under Linux.

My config is below, in case it helps.

Hugo
---

This is ithread specific, I think the bug is that we for some strange
reason, don't move constants to the pad in peep, meaning a op
combination stops the peephole optimizer.

I need to find some time to debug it but haven't yet.

Arthur

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2002

arthur@contiller.se - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 4, 2003

From arthur@contiller.se

Fixed with patch 18820

  Fixes bug #15654
  What happend was that a constant was freed, the pad released but
  the pad slot still held the SV, when pad slot was reallocated
  to be a target for a stringify, it did a sv_setpv on the target
  and the original SV was whiped out. When this SV was later on
  to new places using the constant, they got the wrong value.
  By replacing pad_free with pad_swipe for these cases, we
  won't have such a problem. (pad_swipe also removes the
  pointer to the original SV).

@p5pRT
Copy link
Author

p5pRT commented Mar 4, 2003

arthur@contiller.se - 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