I have built a 64 bit version of Perl 5.10.0 under SLES 10 (x86-64).
I am now installing DBI and DBD::Oracle.

Both of these modules produce alarming warnings at compile time.
E.g.

DBI.xs: In function ‘dbih_setup_fbav’:
DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘int’

I have pasted a transcript of the DBI compilation below. The DBD::Oracle
warnings are similar, but more numerous.

I have looked at the source, and it seems to me that these warnings
are genuine. 32 bit integers are being passed to PerlIO_printf
where the format requires 64 bits. This is incorrect C. The effects
will be architecture dependent, and may include incorrect output and
even core dumps.

That said, the modules pass their tests and seem to work. However,
the incorrect code is mostly only exercised when tracing is turned on.

I wondered why I had never seen this before. It turns out that
Perl 5.10.0 has an improvement in this area. For gcc, the
declaration of PerlIO_printf has been enhanced by the addition
of '__attribute__((format(__printf__,2,3)))'. This, for the
first time, allows gcc to check the types of PerlIO_printf's arguments.

Do others agree with me that these format errors constitute a bug
which needs fixing? If so I will attempt a patch.

In the meanwhile I will retreat to a 32 bit perl.

===============================
transcript follows
===============================
+ perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
 Platform:
   osname=linux, osvers=2.6.16.60-0.34-smp, archname=x86_64-linux-thread-multi
   uname='linux ruff 2.6.16.60-0.34-smp #1 smp fri jan 16 14:59:01 utc 2009 
x86_64 x86_64 x86_64 gnulinux '
   config_args='-des -Dprefix=/usr/local/perl/5.10.0-B -Dusethreads 
-Duse64bitall -Dlibpth=/lib64 /usr/lib64 /usr/local/lib64 
-Dlocincpth=/usr/local/include -A define:libc=/lib64/libc-2.4.so 
-Uinstallusrbinperl -Dman1dir=none -Dman3dir=none -Duseshrplib -Uperladmin 
-Dotherlibdirs=/usr/local/perl5lib'
   hint=recommended, useposix=true, d_sigaction=define
   useithreads=define, usemultiplicity=define
   useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
   use64bitint=define, use64bitall=define, uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
   optimize='-O2',
   cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe 
-I/usr/local/include'
   ccversion='', gccversion='4.1.2 20070115 (SUSE Linux)', gccosandvers=''
   intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
   ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
   alignbytes=8, prototype=define
 Linker and Libraries:
   ld='cc', ldflags =''
   libpth=/lib64 /usr/lib64 /usr/local/lib64
   libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
   perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
   libc=/lib64/libc-2.4.so, so=so, useshrplib=true, libperl=libperl.so
   gnulibc_version='2.4'
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE'
   cccdlflags='-fPIC', lddlflags='-shared -O2'


Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                       PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
                       USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                       USE_PERLIO USE_REENTRANT_API
 Built under linux
 Compiled at Feb 26 2009 10:00:29
 @INC:
   /usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi
   /usr/local/perl/5.10.0-B/lib/5.10.0
   /usr/local/perl/5.10.0-B/lib/site_perl/5.10.0/x86_64-linux-thread-multi
   /usr/local/perl/5.10.0-B/lib/site_perl/5.10.0
   /usr/local/perl5lib
   .
+ perl Makefile.PL

*** Your LANG environment variable is set to 'en_GB.UTF-8'
*** This may cause problems for some perl installations.
*** If you get test failures, please try again with LANG unset.
*** If that then works, please email [email protected] with details
*** including the output of 'perl -V'


*** You are using a perl configured with threading enabled.
*** You should be aware that using multiple threads is
*** not recommended for production environments.

Your perl was compiled with gcc (version 4.1.2 20070115 (SUSE Linux)), okay.
Creating test wrappers for DBI::PurePerl:
t/zvp_01basics.t t/zvp_02dbidrv.t t/zvp_03handle.t t/zvp_04mods.t t/zvp_05concathash.t t/zvp_06attrs.t t/zvp_07kids.t t/zvp_08keeperr.t t/zvp_09trace.t t/zvp_10examp.t t/zvp_11fetch.t t/zvp_12quote.t t/zvp_13taint.t t/zvp_14utf8.t t/zvp_15array.t t/zvp_19fhtrace.t t/zvp_20meta.t t/zvp_30subclass.t t/zvp_35thrclone.t (use threads) t/zvp_40profile.t t/zvp_41prof_dump.t t/zvp_42prof_data.t t/zvp_43prof_env.t t/zvp_50dbm.t t/zvp_60preparse.t t/zvp_65transact.t t/zvp_70callbacks.t t/zvp_72childhandles.t t/zvp_80proxy.t t/zvp_85gofer.t t/zvp_86gofer_fail.t t/zvp_87gofer_cache.t Creating test wrappers for DBD::Gofer: t/zvg_01basics.t t/zvg_02dbidrv.t t/zvg_03handle.t t/zvg_04mods.t t/zvg_05concathash.t t/zvg_06attrs.t t/zvg_07kids.t t/zvg_08keeperr.t t/zvg_09trace.t t/zvg_10examp.t t/zvg_11fetch.t t/zvg_12quote.t t/zvg_13taint.t t/zvg_14utf8.t t/zvg_15array.t t/zvg_19fhtrace.t t/zvg_20meta.t t/zvg_30subclass.t t/zvg_35thrclone.t (use threads) t/zvg_40profile.t t/zvg_41prof_dump.t t/zvg_42prof_data.t t/zvg_43prof_env.t t/zvg_50dbm.t t/zvg_60preparse.t t/zvg_65transact.t t/zvg_70callbacks.t t/zvg_72childhandles.t t/zvg_80proxy.t t/zvg_85gofer.t t/zvg_86gofer_fail.t t/zvg_87gofer_cache.t Creating test wrappers for PurePerl & Gofer: t/zvxgp_01basics.t t/zvxgp_02dbidrv.t t/zvxgp_03handle.t t/zvxgp_04mods.t t/zvxgp_05concathash.t t/zvxgp_06attrs.t t/zvxgp_07kids.t t/zvxgp_08keeperr.t t/zvxgp_09trace.t t/zvxgp_10examp.t t/zvxgp_11fetch.t t/zvxgp_12quote.t t/zvxgp_13taint.t t/zvxgp_14utf8.t t/zvxgp_15array.t t/zvxgp_19fhtrace.t t/zvxgp_20meta.t t/zvxgp_30subclass.t t/zvxgp_35thrclone.t (use threads) t/zvxgp_40profile.t t/zvxgp_41prof_dump.t t/zvxgp_42prof_data.t t/zvxgp_43prof_env.t t/zvxgp_50dbm.t t/zvxgp_60preparse.t t/zvxgp_65transact.t t/zvxgp_70callbacks.t t/zvxgp_72childhandles.t t/zvxgp_80proxy.t t/zvxgp_85gofer.t t/zvxgp_86gofer_fail.t t/zvxgp_87gofer_cache.t Checking if your kit is complete...
Looks good

   I see you're using perl 5.010000 on x86_64-linux-thread-multi, okay.
   Remember to actually *read* the README file!
   Use  'make' to build the software (dmake or nmake on Windows).
   Then 'make test' to execute self tests.
   Then 'make install' to install the DBI and then delete this working
   directory before unpacking and building any DBD::* drivers.

Writing Makefile for DBI
+ make
/usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI
rm -f blib/lib/DBI/Changes.pm
cp Changes blib/lib/DBI/Changes.pm
/usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/DBI
rm -f blib/lib/DBI/Roadmap.pm
cp Roadmap.pod blib/lib/DBI/Roadmap.pm
cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
cp lib/DBI/Gofer/Response.pm blib/lib/DBI/Gofer/Response.pm
cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.pm
cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm
cp lib/DBD/DBM.pm blib/lib/DBD/DBM.pm
cp DBIXS.h blib/arch/auto/DBI/DBIXS.h
cp Roadmap.pod blib/lib/Roadmap.pod
cp dbixs_rev.pl blib/lib/dbixs_rev.pl
cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm
cp lib/DBI/Gofer/Serializer/DataDumper.pm 
blib/lib/DBI/Gofer/Serializer/DataDumper.pm
cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm
cp lib/DBD/Gofer/Transport/pipeone.pm blib/lib/DBD/Gofer/Transport/pipeone.pm
cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm
cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.pm
cp Driver.xst blib/arch/auto/DBI/Driver.xst
cp lib/DBD/File.pm blib/lib/DBD/File.pm
cp lib/DBI/Util/CacheMemory.pm blib/lib/DBI/Util/CacheMemory.pm
cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm
cp lib/DBI/ProfileSubs.pm blib/lib/DBI/ProfileSubs.pm
cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h
cp lib/DBD/Gofer.pm blib/lib/DBD/Gofer.pm
cp dbivport.h blib/arch/auto/DBI/dbivport.h
cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h
cp dbixs_rev.h blib/arch/auto/DBI/dbixs_rev.h
cp lib/DBD/Gofer/Transport/Base.pm blib/lib/DBD/Gofer/Transport/Base.pm
cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm
cp lib/DBD/Gofer/Policy/rush.pm blib/lib/DBD/Gofer/Policy/rush.pm
cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm
cp lib/DBI/Gofer/Request.pm blib/lib/DBI/Gofer/Request.pm
cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm
cp lib/DBD/Gofer/Transport/stream.pm blib/lib/DBD/Gofer/Transport/stream.pm
cp lib/DBD/Gofer/Policy/classic.pm blib/lib/DBD/Gofer/Policy/classic.pm
cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm
cp lib/DBD/Gofer/Policy/Base.pm blib/lib/DBD/Gofer/Policy/Base.pm
cp DBI.pm blib/lib/DBI.pm
cp lib/DBI/Gofer/Serializer/Storable.pm 
blib/lib/DBI/Gofer/Serializer/Storable.pm
cp lib/DBI/Gofer/Transport/stream.pm blib/lib/DBI/Gofer/Transport/stream.pm
cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm
cp lib/DBD/Gofer/Policy/pedantic.pm blib/lib/DBD/Gofer/Policy/pedantic.pm
cp lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm
cp lib/DBI/Gofer/Transport/pipeone.pm blib/lib/DBI/Gofer/Transport/pipeone.pm
cp lib/DBD/Gofer/Transport/null.pm blib/lib/DBD/Gofer/Transport/null.pm
cp lib/Bundle/DBI.pm blib/lib/Bundle/DBI.pm
cp TASKS.pod blib/lib/TASKS.pod
cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm
cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm
cp lib/DBI/ProxyServer.pm blib/lib/DBI/ProxyServer.pm
cp lib/DBI/Gofer/Serializer/Base.pm blib/lib/DBI/Gofer/Serializer/Base.pm
cp dbipport.h blib/arch/auto/DBI/dbipport.h
cp lib/DBI/Gofer/Execute.pm blib/lib/DBI/Gofer/Execute.pm
cp lib/DBI/DBD.pm blib/lib/DBI/DBD.pm
cp lib/Win32/DBIODBC.pm blib/lib/Win32/DBIODBC.pm
cp lib/DBI/PurePerl.pm blib/lib/DBI/PurePerl.pm
cp lib/DBD/ExampleP.pm blib/lib/DBD/ExampleP.pm
cp lib/DBI/ProfileData.pm blib/lib/DBI/ProfileData.pm
/usr/local/perl/5.10.0-B/bin/perl -p -e "s/~DRIVER~/Perl/g" ./Driver.xst > 
Perl.xsi
/usr/local/perl/5.10.0-B/bin/perl /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/xsubpp  
-typemap /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/typemap -typemap typemap  Perl.xs 
> Perl.xsc && mv Perl.xsc Perl.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"1.607\" -DXS_VERSION=\"1.607\" -fPIC 
"-I/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE"  -W -Wall -Wpointer-arith 
-Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter 
Perl.c
Perl.xsi: In function ‘XS_DBD__Perl__db_disconnect’:
Perl.xsi:306: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:306: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Perl.xsi: In function ‘XS_DBD__Perl__db_DESTROY’:
Perl.xsi:352: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:352: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Perl.xsi:380: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:380: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Perl.xsi: In function ‘XS_DBD__Perl__st_finish’:
Perl.xsi:675: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:675: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Perl.xsi: In function ‘XS_DBD__Perl__st_DESTROY’:
Perl.xsi:752: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:752: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Perl.xsi:766: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
Perl.xsi:766: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
/usr/local/perl/5.10.0-B/bin/perl /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/xsubpp  
-typemap /usr/local/perl/5.10.0-B/lib/5.10.0/ExtUtils/typemap -typemap typemap  DBI.xs 
> DBI.xsc && mv DBI.xsc DBI.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"1.607\" -DXS_VERSION=\"1.607\" -fPIC 
"-I/usr/local/perl/5.10.0-B/lib/5.10.0/x86_64-linux-thread-multi/CORE"  -W -Wall -Wpointer-arith 
-Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter 
DBI.c
DBI.xs: In function ‘set_err_sv’:
DBI.xs:623: warning: value computed is not used
DBI.xs: In function ‘set_trace’:
DBI.xs:888: warning: format ‘%lx’ expects type ‘long unsigned int’, but 
argument 6 has type ‘int’
DBI.xs:888: warning: format ‘%ld’ expects type ‘long int’, but argument 7 has 
type ‘unsigned int’
DBI.xs: In function ‘dbih_setup_handle’:
DBI.xs:1289: warning: value computed is not used
DBI.xs:1290: warning: value computed is not used
DBI.xs:1295: warning: value computed is not used
DBI.xs:1298: warning: value computed is not used
DBI.xs: In function ‘dbih_setup_fbav’:
DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘int’
DBI.xs:1549: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has 
type ‘I32’
DBI.xs:1556: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs:1570: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘int’
DBI.xs: In function ‘dbih_set_attr_k’:
DBI.xs:1717: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:1717: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs:1724: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:1724: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs:1926: warning: value computed is not used
DBI.xs: In function ‘dbih_get_attr_k’:
DBI.xs:2017: warning: value computed is not used
DBI.xs:2241: warning: value computed is not used
DBI.xs: In function ‘_profile_next_node’:
DBI.xs:2447: warning: value computed is not used
DBI.xs: In function ‘XS_DBI_dispatch’:
DBI.xs:3000: warning: value computed is not used
DBI.xs:3062: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:3062: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs:3075: warning: value computed is not used
DBI.xs: In function ‘XS_DBI__new_handle’:
DBI.xs:4092: warning: value computed is not used
DBI.xs: In function ‘XS_DBD_____db_take_imp_data’:
DBI.xs:4623: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:4623: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs: In function ‘XS_DBD_____st_fetchrow_hashref’:
DBI.xs:4801: warning: value computed is not used
DBI.xs: In function ‘XS_DBD_____st_finish’:
DBI.xs:4864: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:4864: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs: In function ‘XS_DBD_____st_DESTROY’:
DBI.xs:4878: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:4878: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
DBI.xs:4894: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has 
type ‘I32’
DBI.xs:4894: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has 
type ‘I32’
Running Mkbootstrap for DBI ()
chmod 644 DBI.bs
rm -f blib/arch/auto/DBI/DBI.so
cc  -shared -O2 DBI.o  -o blib/arch/auto/DBI/DBI.so     \
       \
chmod 755 blib/arch/auto/DBI/DBI.so
cp DBI.bs blib/arch/auto/DBI/DBI.bs
chmod 644 blib/arch/auto/DBI/DBI.bs
/usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbiprof.PL dbiprof
Extracted dbiprof from dbiprof.PL with variable substitutions.
dbiprof syntax OK
cp dbiprof blib/script/dbiprof
/usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" 
blib/script/dbiprof
/usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbiproxy.PL 
dbiproxy
Extracted dbiproxy from dbiproxy.PL with variable substitutions.
dbiproxy syntax OK
cp dbiproxy blib/script/dbiproxy
/usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" 
blib/script/dbiproxy
/usr/local/perl/5.10.0-B/bin/perl "-Iblib/arch" "-Iblib/lib" dbilogstrip.PL 
dbilogstrip
Extracted dbilogstrip from dbilogstrip.PL with variable substitutions.
dbilogstrip syntax OK
cp dbilogstrip blib/script/dbilogstrip
/usr/local/perl/5.10.0-B/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" 
blib/script/dbilogstrip

--
Charles Jardine - Computing Service, University of Cambridge
[email protected]    Tel: +44 1223 334506, Fax: +44 1223 334679

Reply via email to