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

Incorrect line number reporting due to overoptimization #224

Closed
p5pRT opened this issue Jul 24, 1999 · 1 comment
Closed

Incorrect line number reporting due to overoptimization #224

p5pRT opened this issue Jul 24, 1999 · 1 comment

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Jul 24, 1999

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

Searchable as RT1031$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Jul 24, 1999

From @tobez

The following script​:

  #! /usr/bin/perl -w
  my $k;
  if (1) {
  #
  #
  #
  my $z = $k+1;
  }

produces ``Use of uninitialized value at bug.pl line 3.'' warning. It
does so in 5.005_03 and 5.005_57.

I tracked the problem down to the optimization performed in op.c's
scope() function, but I am unable to fix it properly (disabling the
optimization does not count, though it fixes the problem). Probably
this output will be helpful for someone​:

[ optimization enabled]
$ perl -MO=Terse bug.pl
bug.pl syntax OK
Use of uninitialized value at /usr/libdata/perl/5.00503/mach/B/Terse.pm line 81.
Use of uninitialized value at /usr/libdata/perl/5.00503/mach/B/Terse.pm line 81.
LISTOP (0x8057940) pp_leave
  OP (0x8059160) pp_enter
  COP (0x80528c0) pp_nextstate
  OP (0x8059120) pp_padsv [1]
  COP (0x8057a00) pp_nextstate
  LISTOP (0x80579c0) pp_scope
  OP (0x8057980) pp_null [173]
  BINOP (0x8059220) pp_sassign
  BINOP (0x8059200) pp_add [3]
  OP (0x80591c0) pp_padsv [1]
  SVOP (0x80591e0) pp_const IV (0x8050ef4) 1
  OP (0x8059180) pp_padsv [2]

The last pp_nextstate corresponds to the line 3.

[ optimization disabled]
$ perl -T bug.pl
Use of uninitialized value at bug.pl line 7.

Correct line number is reported. ^^^^^^

$ perl -T -MO=Terse bug.pl
bug.pl syntax OK
Use of uninitialized value at /usr/libdata/perl/5.00503/mach/B/Terse.pm line 81.
Use of uninitialized value at /usr/libdata/perl/5.00503/mach/B/Terse.pm line 81.
Use of uninitialized value at /usr/libdata/perl/5.00503/mach/B/Terse.pm line 81.
LISTOP (0x8057880) pp_leave
  OP (0x8059500) pp_enter
  COP (0x80528c0) pp_nextstate
  OP (0x80594c0) pp_padsv [1]
  COP (0x8057940) pp_nextstate
  LISTOP (0x8057900) pp_leave
  OP (0x8059600) pp_enter
  COP (0x80578c0) pp_nextstate
  BINOP (0x80595c0) pp_sassign
  BINOP (0x80595a0) pp_add [3]
  OP (0x8059560) pp_padsv [1]
  SVOP (0x8059580) pp_const IV (0x8050ec4) 1
  OP (0x8059520) pp_padsv [2]

pp_scope has been replaced (or is this other way around?) with pp_leave
and pp_enter, and pp_nextstate corresponding to the correct line is
there.

Is there a better way to fix this rather than disabling the optimization
completely?

Perl Info


Site configuration information for perl 5.00503:

Configured by markm at $Date: 1999/05/05 19:09:48 $.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=freebsd, osvers=4.0-current, archname=i386-freebsd
    uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current #0: $Date: 1999/05/05 19:09:48 $'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags=''
    ccflags =''
    stdchar='char', d_stdstdio=undef, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E'
    libpth=/usr/lib
    libs=-lm -lc -lcrypt
    libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-shared'

Locally applied patches:
    


@INC for perl 5.00503:
    /home/tobez/src/Prima
    /home/tobez/src/Prima/scripts/modules
    /usr/libdata/perl/5.00503/mach
    /usr/libdata/perl/5.00503
    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/home/tobez
    LANG=ru_RU.KOI8-R
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/local/site/bin:/home/tobez/bin:/home/tobez/bin/kuim:/plab/usr/home/tobez/bin:/plab/usr/local/site/bin
    PERL5LIB=/home/tobez/src/Prima:/home/tobez/src/Prima/scripts/modules
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/zsh

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

Successfully merging a pull request may close this issue.

None yet
1 participant