Subject: | [PATCH] Problem with 64-bit ints |
Notably, this also occurs with other 64-bit-int versions of perl on
other OSes. The problem is the assumption that an 'unsigned long'
will be the data type that determined the BYTEORDER, which isn't
always the case.
-Allen
Checking if your kit is complete...
Looks good
Writing Makefile for Digest::SHA1
cp SHA1.pm blib/lib/Digest/SHA1.pm
/usr/sbin/perl /usr/share/lib/perl5/5.8.0/ExtUtils/xsubpp -typemap /usr/share/lib/perl5/5.8.0/ExtUtils/typemap -typemap typemap SHA1.xs > SHA1.x
sc && mv SHA1.xsc SHA1.c
cc -n32 -mips4 -r12000 -TARG:platform=ip30:processor=r12000 -Wl,-woff,84 -woff 1009,1110,1047 -c -DDEBUGGING -D_SGI_SOURCE -D_SGI_REENTRANT_FUN
CTIONS -D_SGIAPI -D_POSIX1C -I/server/people/staff/easmith/include -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -woff 1184,1552 -I/usr/local/include -DLANGU
AGE_C -DHAS_LDBL_SPRINTF_BUG -DHAS_LDBL_SPRINTF_BUG_LESS1 -O3 -OPT:fast_exp=ON:Olimit=0 -TENV:X=1 -LNO:opt=1:ou_further=3:gather_scatter=2 -OPT:fold_unsaf
e_relops=OFF:div_split=OFF:IEEE_arithmetic=1:roundoff=0 -OPT:got_call_conversion=OFF:space=OFF -DVERSION=\"2.01\" -DXS_VERSION=\"2.01\" "-I/usr/share
/lib/perl5/5.8.0/IP30-R12000-irix/CORE" SHA1.c
cc-1063 cc: WARNING File = SHA1.xs, Line = 140
The indicated shift count is too large.
W[i] = T32(T >> 32);
PERL_DL_NONLAZY=1 /usr/sbin/perl "-MExtUtils::Command::MM" "-e" "test_harness(1, 'blib/lib', 'blib/arch')" t/*.t
t/badfile....1..2
ok 1
ok 2
ok
t/sha1.......1..5
not ok 1
not ok 2
not ok 3
not ok 4
JqKaI5vWPpX6WXubAwZC66kWrsQ
not ok 5
FAILED tests 1-5
Failed 5/5 tests, 0.00% okay
Failed 1/2 test scripts, 50.00% okay. 5/7 subtests failed, 28.57% okay.
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/sha1.t 5 5 100.00% 1-5
gmake: *** [test_dynamic] Error 2
Configuration:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=irix, osvers=6.5, archname=IP30-R12000-irix-thread-multi-64int-ld
uname='irix64 cesario 6.5 04101931 ip30 '
config_args='-DDEBUGGING -Dusemorebits -Dcc=cc -n32 -mips4 -r12000 -TARG:platform=ip30:processor=r12000 -Wl,-woff,84 -woff 1009,1110,1047'
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=define use64bitall=undef uselongdouble=define
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc -n32 -mips4 -r12000 -TARG:platform=ip30:processor=r12000 -Wl,-woff,84 -woff 1009,1110,1047', ccflags ='-DDEBUGGING -D_SGI_SOURCE -D_SGI_REENTRA
NT_FUNCTIONS -D_SGIAPI -D_POSIX1C -I/server/people/staff/easmith/include -DPTHREAD_H_FIRST -D_BSD_TYPES -D_BSD_TIME -woff 1184,1552 -I/usr/local/include -
DLANGUAGE_C -DHAS_LDBL_SPRINTF_BUG -DHAS_LDBL_SPRINTF_BUG_LESS1',
optimize='-O3 -OPT:fast_exp=ON:Olimit=0 -TENV:X=1 -LNO:opt=1:ou_further=3:gather_scatter=2 -OPT:fold_unsafe_relops=OFF:div_split=OFF:IEEE_arithmetic=1
:roundoff=0 -OPT:got_call_conversion=OFF:space=OFF',
cppflags='-DDEBUGGING -D_SGI_SOURCE -D_SGI_REENTRANT_FUNCTIONS -D_SGIAPI -D_POSIX1C -I/server/people/staff/easmith/include -DPTHREAD_H_FIRST -D_BSD_TY
PES -D_BSD_TIME -I/usr/local/include -DLANGUAGE_C -DHAS_LDBL_SPRINTF_BUG -DHAS_LDBL_SPRINTF_BUG_LESS1'
ccversion='MIPSpro Compilers: Version 7.3.1.3m', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
alignbytes=16, prototype=define
Linker and Libraries:
ld='ld -mips4 -n32 -woff 84', ldflags ='-L/server/people/staff/easmith/lib32 -L/usr/lib32/mips4 -L/usr/lib32 -L/lib32 -rpath /server/people/staff/easm
ith/lib32:/usr/lib32/mips4:/usr/lib32:/lib32 -Wl,-woff,84'
libpth=/server/people/staff/easmith/lib32 /usr/lib32/mips4 /usr/lib32 /lib32
libs=-lgdbm -ldb -lm -lpthread
perllibs=-lm -lpthread
libc=/usr/lib32/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-shared -check_registry /usr/lib32/so_locations -L/server/people/staff/easmith/lib32 -L/usr/lib32/mips4 -L/usr/lib32 -L/lib
32'
With the patch I've included, it tests fine.
-Allen
diff -Naurdb Digest-SHA1-2.01/SHA1.xs Digest-SHA1-2.01.new/SHA1.xs
--- Digest-SHA1-2.01/SHA1.xs Wed Mar 14 00:14:54 2001
+++ Digest-SHA1-2.01.new/SHA1.xs Sun Sep 15 22:40:34 2002
@@ -20,7 +20,15 @@
/* Useful defines & typedefs */
+#ifdef U64TYPE
+#if defined(USE_64_BIT_INT) || ((BYTEORDER != 0x1234) && (BYTEORDER != 0x4321))
+typedef U64TYPE ULONG;
+#else
typedef unsigned long ULONG; /* 32-or-more-bit quantity */
+#endif
+#else
+typedef unsigned long ULONG;
+#endif
#define SHA_BLOCKSIZE 64
#define SHA_DIGESTSIZE 20