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

Bug in Storable???

Thread Next
From:
Torsten Foertsch
Date:
May 4, 2003 04:55
Subject:
Bug in Storable???
Message ID:
200305041353.45367.torsten.foertsch@gmx.net
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have encountered a problem with Storable but I don't know whether to call it 
a bug or not.

The shortest way to reproduce it is:

perl -MStorable -e 'my $x=0;
                    foreach (@ARGV) {/(\d+)/ and $x+=$1;}
                    store([$x], "xx");' 2385893486 173938436

Then check the content of "xx":
perl -MStorable -MData::Dumper -e 'print Dumper( retrieve "xx" )'

and the sum of 2385893486 and 173938436 appears as:
$VAR1 = [
          '-1735135374'
        ];

But if the foreach loop is slightly changed
                    foreach (@ARGV) {/(\d+)/ and $x+=$1; $x.="";}
or
                    foreach (@ARGV) {$x+=$_;}
you will get the right result:
$VAR1 = [
          '2559831922'
        ];


Some Notes:
- - If Data::Dumper is used to store the ARRAY I always get the right result.
- - 2385893486 is beyond the MAX_INT limit of my machine
- - 173938436 is less than MAX_INT
- - if the numbers are changed to be both less than MAX_INT but their sum is
  greater Storable stores a negative value
- - if both numbers are greater than MAX_INT the right result appears.


I have tested it with Storable 2.04 and 2.06 and

opi:~ # perl -V 
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.19, archname=i586-linux-thread-multi
    uname='linux bloembergen 2.4.19 #1 mon apr 15 08:57:26 gmt 2002 i686 
unknown '
    config_args='-ds -e -Dprefix=/usr -Dusethreads -Di_db -Di_dbm -Di_ndbm 
- -Di_gdbm -Duseshrplib=true'
    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 ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing 
- -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 --pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
    ccversion='', gccversion='3.2', 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=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic 
- -Wl,-rpath,/usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Sep  9 2002 18:13:56
  @INC:
    /usr/lib/perl5/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl


Torsten
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+tP9JwicyCTir8T4RAlm+AJ9SH/KtlCofoMNs2lN6nNlufzlBnQCbBFeb
9g9uaL8GwsZWOVMwo/adsSs=
=zbVm
-----END PGP SIGNATURE-----

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