From: "Andreas Tobler" <[EMAIL PROTECTED]>

[ultra10:gcc/gcc/testsuite] andreast% svn diff gcc.dg/c99-math-double-1.c
Index: gcc.dg/c99-math-double-1.c
===================================================================
--- gcc.dg/c99-math-double-1.c  (revision 132096)
+++ gcc.dg/c99-math-double-1.c  (working copy)
@@ -3,6 +3,13 @@

 #include <math.h>
 #include "c99-math.h"
+#undef isinf
+#define isinf(x) __extension__ ({ const __typeof (x) __x_i = (x); \
+__builtin_expect(sizeof(__x_i) == sizeof(float) \
+ ? isgreater(__builtin_fabsf(__x_i),__FLT_MAX__) \
+   : sizeof(__x_i) == sizeof(long double) \
+   ? isgreater(__builtin_fabsl(__x_i),__LDBL_MAX__) \
+     : isgreater(__builtin_fabs(__x_i),__DBL_MAX__), 0); })

 int main(void)
 {

The test does complete w/o abort.

Also the other two tests complete (applied the above on them too).

Great, we're making progress.

On mainline only (not 4.2 or prior) does this work instead?

#undef isinf
#define isinf(x) __builtin_isinf(x)



How about this?  (Can be run on any branch)  Hopefully there are no typos...

#undef isinf
#define isinf(x)        __extension__( \
                       { __typeof(x) __x_i = (x); ! isnan(__x_i) && \
                       (__x_i == (__typeof(__x_i)) INFINITY || \
                       __x_i == (__typeof(__x_i)) (-INFINITY)); })

The __builtin_inf(x) style up above is what is done on mainline for solaris10. The second one is what is done in the solaris11 system header but I added a !isnan(x). I'm not sure which of these styles makes the most sense to plug into fixincludes.

Another option would be to file a bug report with sun and have them fix the header internally using one of these three methods. I think they'd choose the latter as it should work with any gcc version, not just the latest ones. But that's up to them. In fixincludes we're free to make any choice we want for mainline and/or branches as needed.

Thoughts?

       Thanks,
       --Kaveh
--
Kaveh R. Ghazi


Reply via email to