This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc-3.3 mipsel -msoft-float broken? test case included


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

Attachment: test.ii
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]