[gnu.gcc.bug] __fixunsdfsi

eirik@ELF.TN.CORNELL.EDU (01/05/90)

This message concerns gcc 1.36.91

The following patch to gnulib.c

*** gnulib.c	Thu Dec 21 16:04:12 1989
--- _fixunsdfsi.c	Thu Jan  4 17:57:12 1990
***************
*** 199,205 ****
--- 199,209 ----
       By adding at first, rather that subtracting,
       we ensure the numbers are always positive when converted to fixed point,
       so they are always rounded down.  */
+ #ifdef sparc
+   return (unsigned SItype) a;
+ #else
    return ((SItype) (a + HIGH_BIT_COEFF)) - HIGH_BIT_INT_COEFF;
+ #endif
  }
  #endif
  
changes the output of the following program on a sun4/260

main()
{
  double d=1.25;
  printf("%f %d\n",d,__fixunsdfsi(d));
  exit(0);
}

Without this patch, Sun cc and gcc generate similar code for
__fixunsdfsi, so it seems more like a pecularity of sparc floating
point than a compiler bug.  With the patch, gcc generates a recursive
call and cc generates a call to a library routine.