develooper Front page | perl.perl5.porters | Postings from June 2018

[perl #133239] Very misleading line number for warnings in somecases

Thread Previous | Thread Next
Stephen E. Dewey
June 4, 2018 13:25
[perl #133239] Very misleading line number for warnings in somecases
Message ID:
# New Ticket Created by  Stephen E. Dewey 
# Please include the string:  [perl #133239]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.16.3.

[Please describe your issue here]

I have provided a full description of the bug on StackOverflow
at I will keep that
question up-to-date in case I come across anything new.

For convenience, here is what I wrote there:
I have isolated a case where Perl provides a very misleading line number in a warning message. I tested the below in Strawberry Perl 5.16.3.

use strict;
use warnings;

my $choice = 0;

while ($choice == 0){

    #Pretend the user provided this via STDIN
    $choice = '5,6,7';

    if ($choice eq '-4'){
        print "This isn't going to happen\n";

When you run this, you will get the warning message Argument "5,6,7" isn't numeric in numeric eq (==) at line 11. But line 11 corresponds to the line if ($choice eq '-4'){ which cannot possibly cause this warning message because it does not contain a numeric comparison.

It seems what's actually happening is that Perl advances to the next comparison, while ($choice == 0){, but the line counter used for the warning message does not advance.

What makes this particular case worse is that, since the "bad" comparison is the loop condition, it is actually far away from the provided line. In my (pre-simplification) script, it was hundreds of lines away from the provided line number.

Is this a bug or just an unfortunate limitation of the parser?

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

Configured by strawberry-perl at Tue Mar 12 12:12:58 2013.

Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

    osname=MSWin32, osvers=4.0, archname=MSWin32-x64-multi-thread
    uname='Win32 strawberry-perl #1 Tue Mar 12 12:12:07 2013 x64'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
    optimize='-s -O2',
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++.exe', ldflags ='-s -L"C:\berrybrew\5.16.3_64\perl\lib\CORE" -L"C:\berrybrew\5.16.3_64\c\lib"'
    libpth=C:\berrybrew\5.16.3_64\c\lib C:\berrybrew\5.16.3_64\c\x86_64-w64-mingw32\lib
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl516.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s -L"C:\berrybrew\5.16.3_64\perl\lib\CORE" -L"C:\berrybrew\5.16.3_64\c\lib"'

Locally applied patches:

@INC for perl 5.16.3:

Environment for perl 5.16.3:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\berrybrew\5.16.3_64\c\bin;C:\berrybrew\5.16.3_64\perl\bin;C:\berrybrew\5.16.3_64\perl\site\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\SysWOW64\~FDSTools;C:\windows\SysWOW64\~FDSTools\SysinternalsSuite;C:\Program Files (x86)\Graphviz2.38\bin;C:\Program Files\Perforce;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\PuTTY\;C:\Program Files (x86)\WinMerge;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3\Library\bi
 n;C:\Program Files (x86)\FAHClient;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files (x86)\Calibre2\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\MATLAB\R2017b\bin;C:\Users\sdewey\berrybrew\bin;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Program Files\apache-maven-3.5.3\bin;C:\Program Files\Spring\spring-2.0.1.BUILD-SNAPSHOT\bin;c:\python27\scripts;C:\Users\sdewey\Documents\berrybrew\bin;C:\Users\sdewey\scoop\shims;C:\Program Files (x86)\Graphviz2.38\bin;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\sdewey\AppData\Local\Continuum\Anaconda3\Library\bin;C:\Program Files (x86)\FAHClient;C:\Users\sdewey\AppData\Local\atom\bin;C:\Users\sdewey\AppData\Local\Programs\Fiddler;C:\Users\sdewey\AppData\Roaming\factsetio\bin\;C:\Users\sdewey\AppData\Roaming\npm
    PERL_BADLANG (unset)
    SHELL (unset)

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