develooper Front page | perl.perl5.porters | Postings from December 2008

[perl #60954] warnings from while() condition are reported from wrong line

Thread Next
Tim Bunce
December 1, 2008 17:29
[perl #60954] warnings from while() condition are reported from wrong line
Message ID:
# New Ticket Created by  Tim Bunce 
# Please include the string:  [perl #60954]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from Tim Bunce <>
generated with the help of perlbug 1.35 running under perl v5.8.6.

[Please enter your report here]

Reproduced on perl5.8.6 and v5.11.0 DEVEL34703.

After executing the last statement in a while() block perl doesn't
update its concept of the current line number when it evaluates the
while condition.  So any warnings generated by the condition are
reported as being from whatever line was last executed within the block:

$a = 3;
while(warn("while"), $a--) {  # first warn reports this line
    $a;                  # subsequent warns report this line

# the 'current line' is whatever line was last executed
$a = 3;
while(warn("while"), $a--) {  # first warn reports this line
    next;                # subsequent warns report this line

# adding a continue block avoids the problem
$a = 3;
while((warn "while"), $a--) {  # all warns report this line
continue {

This may seem like a minor issue but I've rated it 'high' because it has a
significant impact on accuracy of statement based profilers like NYTProf.

Seems like OP_UNSTACK needs to be smarter.

Naturally any solution shouldn't slow perl down.

If a slowdown is unavoidable then perhaps only implement it if $^P & 0x2
(line-by-line debugging) is true at compile time.

[Please do not change anything below this line]
Site configuration information for perl v5.8.6:

Configured by timbo at Thu May 25 17:26:37 IST 2006.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
    osname=darwin, osvers=8.5.2, archname=darwin-thread-multi-2level
    uname='darwin 8.5.2 darwin kernel version 8.5.2: mon feb 13 16:31:48 pst 2006; root:xnu-792.8.37.obj~1release_i386 i386 i386 '
    config_args='-des -Dprefix=/usr/local/perl58-i -Doptimize=-g -Duseithreads -Dusemultiplicity'
    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
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include',
    cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build 5250)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib'

Locally applied patches:

@INC for perl v5.8.6:

Environment for perl v5.8.6:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About