Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ELF.TN.CORNELL.EDU!eirik From: eirik@ELF.TN.CORNELL.EDU Newsgroups: gnu.gcc.bug Subject: __fixunsdfsi Message-ID: <9001042315.AA03499@elf.TN.Cornell.EDU> Date: 4 Jan 90 23:15:24 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 33 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.