Fix for PR 15235 libgfortran doesn't build on Solaris

Andrew Pinski pinskia@physics.uc.edu
Tue May 18 18:39:00 GMT 2004


On May 18, 2004, at 14:28, Rainer Orth wrote:
No, this won't help at all: even in that case, GCC won't provide a
__builtin_isnan.  See tm.texi for TARGET_C99_FUNCTIONS:
@defmac TARGET_C99_FUNCTIONS
When this macro is nonzero, GCC will implicitly optimize @code{sin} 
calls into
@code{sinf} and similarly for other functions defined by C99 standard. 
 The
default is nonzero that should be proper value for most modern 
systems, however
number of existing systems lacks support for these functions in the 
runtime so
they needs this macro to be redefined to 0.
@end defmac

But otherwise you're right: if Solaris 10 provides a complete ISO C99
library which is usable by GCC, then we should have e.g. sol10.h which
defines that macro.
The following patch with in conjunction with setting 
TARGET_C99_FUNCTIONS
to 1 will get the needed builtins (and should get solaris 10 to work 
correctly
unless isnan/isnanf is no longer in libm):

Index: builtins.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.def,v
retrieving revision 1.83
diff -u -p -r1.83 builtins.def
--- builtins.def	13 May 2004 06:39:27 -0000	1.83
+++ builtins.def	18 May 2004 18:35:49 -0000
@@ -241,6 +241,8 @@ DEF_C99_BUILTIN        (BUILT_IN_ILOGBL,
 DEF_GCC_BUILTIN        (BUILT_IN_INF, "inf", BT_FN_DOUBLE, 
ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_INFF, "inff", BT_FN_FLOAT, 
ATTR_CONST_NOTHROW_LIST)
 DEF_GCC_BUILTIN        (BUILT_IN_INFL, "infl", BT_FN_LONGDOUBLE, 
ATTR_CONST_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISNAN, "isnan", BT_FN_DOUBLE_DOUBLE, 
ATTR_CONST_NOTHROW_LIST)
+DEF_C99_BUILTIN        (BUILT_IN_ISNANF, "isnanf", BT_FN_FLOAT_FLOAT, 
ATTR_CONST_NOTHROW_LIST)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_J0, "j0", BT_FN_DOUBLE_DOUBLE, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_J0F, "j0f", BT_FN_FLOAT_FLOAT, 
ATTR_MATHFN_FPROUNDING_ERRNO)
 DEF_EXT_LIB_BUILTIN    (BUILT_IN_J0L, "j0l", 
BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)

Adding more like constant folding of the builtin can come next and such.

Andrew Pinski




More information about the Gcc mailing list