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

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

Thread Next
From:
Tim Bunce
Date:
December 1, 2008 17:29
Subject:
[perl #60954] warnings from while() condition are reported from wrong line
Message ID:
rt-3.6.HEAD-10965-1228129662-1763.60954-75-0@perl.org
# New Ticket Created by  Tim Bunce 
# Please include the string:  [perl #60954]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60954 >


This is a bug report for perl from Tim Bunce <Tim.Bunce@pobox.com>
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:

#!perl
$a = 3;
while(warn("while"), $a--) {  # first warn reports this line
    $a;
    $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
    $a;
    next;                # subsequent warns report this line
    $a;
}

# adding a continue block avoids the problem
$a = 3;
while((warn "while"), $a--) {  # all warns report this line
    $a;
    $a;
}
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]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
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:
  Platform:
    osname=darwin, osvers=8.5.2, archname=darwin-thread-multi-2level
    uname='darwin ppp-117.la.vclk.net 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
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include',
    optimize='-g',
    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
    gnulibc_version=''
  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:
    /usr/local/perl58-i/lib/5.8.6/darwin-thread-multi-2level
    /usr/local/perl58-i/lib/5.8.6
    /usr/local/perl58-i/lib/site_perl/5.8.6/darwin-thread-multi-2level
    /usr/local/perl58-i/lib/site_perl/5.8.6
    /usr/local/perl58-i/lib/site_perl
    .

---
Environment for perl v5.8.6:
    HOME=/Users/timbo
    LANG=en_IE.UTF-8
    LANGUAGE (unset)
    LC_ALL=en_IE.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/timbo/bin:/usr/local/perl58-i/bin:/usr/local/mysql/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
    PERLCRITIC=/Users/timbo/.setdev/perlcriticrc
    PERLTIDY=/Users/timbo/.setdev/perltidyrc
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About