This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: solaris2 float.h/limits.h conflict



   Date: Fri, 12 Feb 1999 19:34:43 -0800
   From: Jim Wilson <wilson@cygnus.com>

Why not take the fixinc.wrap approach, and suppress the installation
of GCC's float.h on Solaris?  That way, GCC will use the Solaris
/usr/include/float.h, and won't generate those bothersome warnings.

I just compared GCC's float.h to Solaris 7's float.h, and I see that
using the Solaris float.h will also fix a code-generation bug.
Currently, GCC-generated code computes the wrong value for FLT_ROUNDS
on Solaris when the program is using non-default rounding mode.  This
is because GCC's float.h says this:

#define FLT_ROUNDS 1

whereas the correct definition (in /usr/include/float.h) on Solaris
sparc is this:

#define	FLT_ROUNDS __flt_rounds()

where __flt_rounds is defined by the Solaris C library.  So we can
kill two birds with one stone by using Solaris's float.h instead of
GCC's.


   float.h has
	   #define DBL_MAX 1.7976931348623157e+308
   and limits.h has
	   #define	DBL_MAX		1.7976931348623157E+308
   so we can make the problem go away by changing the 'e' in float.h to an 'E'.

This approach would be trickier than simply replacing 'e' with 'E'.  E.g.:

GCC's   float.h :#define FLT_MAX 3.40282347e+38F
Solaris limits.h:#define FLT_MAX 3.402823466E+38F

In general, we'd have to copy all the constants from the system
float.h to GCC's float.h.  That would not be in accordance with the
fixinc.wrap philosophy, which is to use the system include files as-is
when possible.