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

[perl #24767] pack/unpack combo returns incorrect values in 5.8.0 on RHES3.0

Thread Previous
From:
Dr. John W. Glendening
Date:
December 28, 2003 16:34
Subject:
[perl #24767] pack/unpack combo returns incorrect values in 5.8.0 on RHES3.0
Message ID:
rt-3.0.7_01-24767-68952.6.92262755155461@perl.org
# New Ticket Created by  "Dr. John W. Glendening" 
# Please include the string:  [perl #24767]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=24767 >



I find that a simple pack/unpack combination fails to return the
original FP number when running perl 5.8.0 on a RHES3.0 Linux system.
The test program that I use has correctly worked on many varieties of
perl and OSes, including SGI OS as well as Linux, and is attached at the
end, as is the perlbug info.  But on this system the output line which
compares an original value to the corresponding unpacked value reads:
A= 63999 B= 2.9076947013346e-17
instead of the correct
A= 63999 B= 63999

=========
PROGRAM:
=========
#! /usr/local/bin/perl -w
#### TEST ARRAY READ/WRITE TO FILE USING PACK/UNPACK #####
### CREATE TEST ARRAY WITH VALUE EQUAL TO ITS INDEX
$npt = 64000;
for ( $ipt=0;  $ipt<$npt; $ipt++ )
{ $a[$ipt] = $ipt; }
  ### PACK ARRAY AND WRITE TO FILE
  `rm -f tmp.test.pack`;
  open ( ARRAYFH, ">>tmp.test.pack");
  $stringout = pack( "d*",@a );
  printf ARRAYFH "%s", $stringout;
  close (ARRAYFH);
  ### READ FROM FILE AND UNPACK ARRAY
  open ( ARRAYFH, "<tmp.test.pack");
  @stringin = <ARRAYFH>;
  close (ARRAYFH);
  @b = unpack( "d*", join('',@stringin) );
### COMPARE AN ORIGINAL VALUE TO CORRESPONDING UNPACKED VALUE
$iprt = 63999;
print "A= $iprt B= $b[$iprt] \n";


============
PERLBUG INFO:
=============
Flags:
    category=
    severity=
---
Site configuration information for perl v5.8.0:Configured by bhcompile'
cf_email='bhcompile at Mon Sep 15 10:01:56 EDT 2003.

Summary of my rderl (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.21-1.1931.2.393.entsmp, 
archname=i386-linux-thread-multi
    uname='linux por'
    config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 
-Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc $
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef'
 useithreads=define usemultiplicity=
    useperlio= d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=un uselongdouble=
    usemymalloc=, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_$
    optimize='',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/includ$
    ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-19)', 
gccosandvers=''
gccversion='3.2.3 200305'
    intsize=o, longsize=s, ptrsize=l, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long'
k', ivsize=4'
ivtype, nvtype='double'
o_no', nvsize=, Off_t='', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc'
l', ldflags =' -L/usr/local/lib'
ldflags_use'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libper
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi$
    cccdlflags='-fPIC'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s 
Unicode/Normalize XS/A'

Locally applied patches:
    MAINT18379

---
@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.0
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi
    /usr/lib/perl5/5.8.0
    .

---
Environment for perl v5.8.0:
    HOME=/home/admin
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)     
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.:/home/admin/BAT:/home/admin/DRJACK/BLIP/NCARG/bin:/home$
    PERL_BADLANG (unset)
    SHELL=/bin/bash
    dlflags='-share (unset)


-- 
Dr. John W. (Jack) Glendening   Meteorologist

Thread Previous


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