develooper Front page | perl.perl5.porters | Postings from September 2005

[perl #37302] if ... elsif gives wrong line # for warning about undefined value

Thread Next
From:
ludemann @ yahoo-inc . com
Date:
September 28, 2005 17:05
Subject:
[perl #37302] if ... elsif gives wrong line # for warning about undefined value
Message ID:
rt-3.0.11-37302-121760.15.9413506989602@perl.org
# New Ticket Created by  ludemann@yahoo-inc.com 
# Please include the string:  [perl #37302]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37302 >


This is a bug report for perl from ludemann@yahoo-inc.com,
generated with the help of perlbug 1.33 running under perl v5.6.1.


-----------------------------------------------------------------
[Please enter your report here]

My problem code had something like this:

  if (defined $a && $a =~ m/.../) { # line 1 <== got warning about this
     ...
  } elsif ($b =~ m/.../) { # line 3 <== but real problem was here
     ...
  } else {
     ...
  }

This was getting an occasional, clearly bogus, warning about an
undefined variable in line 1. The actual undefined variable was in
line 3.

   (BTW, the message "Use of uninitialized value in pattern match
   (m//)" could be improved ... it's not clear whether the pattern
   contains an uninitialized value or the value that's being pattern
   matched is uninitialized.) 

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.6.1:

Configured by rr at Thu Mar  7 23:10:53 PST 2002.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=freebsd, osvers=4, archname=i386-freebsd
    uname='FreeBSD pkgbuild2.corp.yahoo.com 4.1-YAHOO-20001028 FreeBSD 4.1-YAHOO-20001028 #0: Sat Dec  1 16:59:23 PST 2001     root@pkgbuild2.corp.yahoo.com:/home/obj/home/src/sys/YAHOO  i386'
    config_args=''
    hint=previous, 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='gcc', ccflags ='-fno-strict-aliasing -I/home/y/include -I/usr/local/include -march=pentiumpro -pipe',
    optimize='-g -O2',
    cppflags='-fno-strict-aliasing -I/home/y/include -I/usr/local/include -march=pentiumpro -pipe'
    ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='freebsdelf'
    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='gcc', ldflags ='-Wl,-E  -L/home/y/lib -L/usr/local/lib'
    libpth=/usr/lib /home/y/lib /usr/local/lib
    libs=-lm -lc -lcrypt -lutil
    perllibs=-lm -lc -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-R/home/y/lib/perl5/5.6.1/i386-freebsd/CORE -Wl,-R/home/y/lib -Wl,-R/usr/local/lib'
    cccdlflags='-DPIC -fpic', lddlflags='-shared  -L/home/y/lib -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.1:
    /home/y/lib/perl5/5.6.1/i386-freebsd
    /home/y/lib/perl5/5.6.1
    /home/y/lib/perl5/site_perl/5.6.1/i386-freebsd
    /home/y/lib/perl5/site_perl/5.6.1
    /home/y/lib/perl5/site_perl
    .

---
Environment for perl v5.6.1:
    HOME=/homes/ludemann
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/homes/ludemann/bin:/homes/ludemann/script:/home/y/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/usr/common/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/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