gcc-3.3 mipsel -msoft-float broken? test case included
David Wuertele
dave-gnus@bfnet.com
Sun Aug 10 21:17:00 GMT 2003
I'm building gcc-3.3 for mipsel-uClibc. Erik Anderson (of uClibc)
looked at the my bad float behavior (fprintf of a float always prints
"nan") and guesses that the va_copy() in _ppfs_prepargs() is not
properly dealing with soft-float.
Test source (test.ii is attached below):
#include <stdio.h>
int main ()
{
double thisdub = (double)0.1;
if ((thisdub - (double)0.1) > 0.000001) {
fprintf (stderr, "doubles are hosed!\n");
return 0;
}
if ((thisdub != (double)0.1)) {
fprintf (stderr, "doubles are weak!\n");
return 0;
}
fprintf (stderr, "if %f and %f don't both equal 0.100000,"
"suspect fprintf\n", (float)thisdub, (float)0.1);
unsigned long height1 = 120;
unsigned long height2 = 1200;
float scale1 = (float)height1 / (float)height2;
double height3 = height2 * scale1;
unsigned long height4 = (unsigned long) height3;
fprintf (stderr, "if %f and %f aren't close to %lu, "
"suspect float operations\n",
(float)height3, (float)height4, height1);
return 0;
}
Compilation:
$ uname -a
Linux rave.localdomain 2.4.20-9smp #1 SMP Wed Apr 2 13:15:14 EST 2003 i686 athlon i386 GNU/Linux
$ mipsel-uclibc-gcc -msoft-float -o mgcc-softfloat test.cpp
$ mipsel-uclibc-gcc -o mgcc-kernelemu test.cpp
Execution (on mipsel-uclibc system with no FPU):
sh-2.05b# ./mgcc-softfloat
doubles are weak!
sh-2.05b# ./mgcc-kernelemu
if nan and nan don't both equal 0.100000,suspect fprintf
if nan and nan aren't close to 120, suspect float operations
sh-2.05b#
GCC Version info:
$ mipsel-uclibc-gcc -v
Reading specs from /home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/lib/gcc-lib/mipsel-linux/3.3/specs
Configured with: /home/dave/C/perforce/source/os/buildroot-M14.0-X225/toolchain_build_mipsel/gcc-3.3/configure --target=mipsel-linux --host=i386-pc-linux-gnu --build=i386-pc-linux-gnu --prefix=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir --exec-prefix=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir --bindir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/bin --sbindir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/sbin --sysconfdir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/etc --datadir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/share --localstatedir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/var --mandir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/man --infodir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/info --with-local-prefix=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/usr/local --libdir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/lib --includedir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/include --with-gxx-include-dir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/include/c++ --oldincludedir=/home/dave/C/perforce/source/os/buildroot-M14.0-X225/build_mipsel/staging_dir/include --enable-shared --enable-multilib --enable-target-optspace --disable-nls --with-gnu-ld --disable-__cxa_atexit --enable-languages=c,c++ --nfp --without-float --program-prefix=mipsel-uclibc-
Thread model: posix
gcc version 3.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ii
Type: application/octet-stream
Size: 33058 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20030810/b636d710/attachment.obj>
More information about the Gcc
mailing list