Front page | perl.perl5.porters |
Postings from October 1999
SvIOK failing for perfectly good integer values
From:
W. Phillip Moore
Date:
October 25, 1999 10:33
Subject:
SvIOK failing for perfectly good integer values
Message ID:
14356.37986.431511.475802@gargle.gargle.HOWL
Context: this problem occurs for perl5.00502 and perl5.00404 on
Solaris 2.5.1.
I have a scenario where an XS routine is called:
MQSET($a, $b, $c, $d, %keys);
where the keys of the %keys hash are all numeric, eg. 2013. Inside
this XS routine, which has to parse a variable number of arguments, it
validates the keys and checks to be sure they are integers, and does
so by calling SvIOK() on the argument.
This is failing if I do this:
@foo = ( 2013, "some string" );
MQSET($a, $b, $c, $d, @foo);
but if works fine if I do this:
MQSET($a, $b, $c, $d, 2013, "some string");
Even when SvIOK() returns false, I can still extract the number, and
printf it via printf, with no problem. That is,
SvIOK(tempSV)
fails, but:
tempSelector = SvIV(tempSV);
printf("Selector is '%d'\n",tempSelector);
will show the correct integer value.
As a short term workaround, I've just removed the use of SvIOK() to
sanity check the data, since there is further app-specific error
checking of the resulting integer value anyway.
I will work on producing a small test case for this, assuming I can
find time (the module this lives in is huge, and can't be compiled
with a 3rd party product).
-----
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=solaris, osvers=2.5.1, archname=sun4-solaris
uname='sunos sascs2 5.5.1 generic_103640-17 sun4u sparc sunw,ultra-enterprise '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='/ms/dist/fsf/PROJ/egcs/default/bin/gcc', optimize='-O', gccversion=egcs-2.90.23 980102 (egcs-1.0.1 release)
cppflags='-I/ms/dist/aurora/PROJ/libdb/1.85.2/common/include -I/ms/dist/aurora/PROJ/bind/4.9.3b24.1/common/include -I/ms/dist/fsf/PROJ/gdbm/1.7.3.1/common/include'
ccflags ='-I/ms/dist/aurora/PROJ/libdb/1.85.2/common/include -I/ms/dist/aurora/PROJ/bind/4.9.3b24.1/common/include -I/ms/dist/fsf/PROJ/gdbm/1.7.3.1/common/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='/ms/dist/fsf/PROJ/egcs/default/bin/gcc', ldflags =' -L/ms/dist/aurora/PROJ/libdb/1.85.2/exec/lib -L/ms/dist/fsf/PROJ/gdbm/1.7.3.1/exec/lib'
libpth=/ms/dist/aurora/PROJ/libdb/1.85.2/exec/lib /ms/dist/fsf/PROJ/gdbm/1.7.3.1/exec/lib /lib /usr/lib /usr/ccs/lib /usr/local/lib
libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/ms/dist/aurora/PROJ/libdb/1.85.2/exec/lib -L/ms/dist/fsf/PROJ/gdbm/1.7.3.1/exec/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at Sep 24 1998 16:27:42
@INC:
/ms/dist/perl5/PROJ/core/5.00502/exec/lib/perl5
/ms/dist/perl5/PROJ/core/5.00502/common/lib/perl5
/ms/dist/perl5/VERS/5.005/lib/perl5
/ms/dist/perl5/lib/perl5
/ms/dist/aurora/lib/perl5
.