develooper Front page | perl.perl5.porters | Postings from May 2002

[ID 20020531.006] vec assignments generate 2 warnings, I'd prefernone

Thread Next
David Dyck
May 31, 2002 09:26
[ID 20020531.006] vec assignments generate 2 warnings, I'd prefernone
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.33 running under perl v5.7.3.

[Please enter your report here]

The following script issues warnings (2 of them) for
vec assignments, while normal assignments to scalars
don't generate any warnings.  Since perl guarantees that
the extra bits are filled with zeros, I believe it
should not issue these warnings.

While the script demonstrates simple cases, the
testing if the hash element exists and pre-initializing
it before the vec assignment complicates production 
scripts, and I'd strongly prefer to avoid "no warnings".

Use of uninitialized value in vec at line 16.
Use of uninitialized value in scalar assignment at line 16.
Use of uninitialized value in vec at line 17.
Use of uninitialized value in scalar assignment at line 17.

$ cat

use warnings;
use strict;

my ($s, %sh);
$s = 1;
$sh{foo} = 1;

#If an element off the end of
#the string is written to, Perl will first extend
#the string with sufficiently many zero bytes.
# yet perl generates 2 warnings each for the following 2 vec assignments.
#   Use of uninitialized value in vec
#   Use of uninitialized value in scalar assignment 
my ($v, %vh);
vec($v,0,1) = 1;
vec($vh{foo},0,1) = 1;

# to avoid warnings must pre-init vectors

my ($wv, %wvh);
$wv = $wvh{foo} = '';
vec($wv,0,1) = 1;
vec($wvh{foo},0,1) = 1;

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

Configured by dcd at Tue May 28 12:01:59 PDT 2002.

Summary of my perl5 (revision 5.0 version 7 subversion 3 patch 16840) configuration:
    osname=linux, osvers=2.4.19-pre8-ac4, archname=i686-linux
    uname='linux dd 2.4.19-pre8-ac4 #1 thu may 16 10:27:27 pdt 2002 i686 '
    config_args='-Dmksymlinks -Dinstallusrbinperl -Uversiononly -Dusedevel -Doptimize=-O3 -g -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs- 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    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=4
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl v5.7.3:

Environment for perl v5.7.3:
    LANG (unset)
    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