Subject: | t/local/00_ptr_cast.t fails due to bad sprintf format |
System info:
$ uname -a
Linux quark 2.6.27-7-generic #1 SMP Thu Oct 30 04:12:22 UTC 2008 x86_64
GNU/Linux
$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.3.2-1ubuntu11' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11)
The sprintf() format string in t/local/ptr_cast_test.c is trying to cast
an unsigned long as a regular int and this causes the test suite to fail:
t/local/00_ptr_cast.t .......... 1/5
# Failed test 'STDERR empty after compiling'
# at t/local/00_ptr_cast.t line 28.
# got: 't/local/ptr_cast_test.c: In function ‘main’:
# t/local/ptr_cast_test.c:27: warning: format ‘%d’ expects type ‘int’,
but argument 4 has type ‘long unsigned int’
# t/local/ptr_cast_test.c:27: warning: format ‘%d’ expects type ‘int’,
but argument 6 has type ‘long unsigned int’
# '
# expected: ''
# Looks like you failed 1 test of 5.
An easy workaround is to change the format string on line 26 to use %lu
instead of %d.