This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Tweak gcc.dg/single-precision-constant.c for IRIX


On Thu, Feb 09, 2006 at 10:32:40AM -0700, Roger Sayle wrote:
> The test case gcc.dg/single-precision-constant.c appears to be failing
> on many platforms due to its use of the C99 "isinf" function/macro.
> The patch below fixes this failure on systems like MIPS/IRIX where
> -std=gnu99 is needed to obtain the appropriate macro definitions.
> Unfortunately, something different is required for Solaris and Tru64
> whose <math.h> don't define/declare "isinf".

IIRC the SunPRO compilers ship with a definition of isinf(). The
workaround used to be the following (only for Solaris):

#include <ieeefp.h>
int isinf(double x) { return !finite(x) && x==x; }

I think you needed to include "sunmath.h" to include the system supplied
definition of isinf().

> Perhaps this code should be rewritten and placed in the ieee directory
> as it relies on properties of IEEE floating point?

True. Any recommendations on how to handle the definition for isinf()?
 
> In the mean-time, the patch below fixes this testsuite failure on
> mips-sgi-irix6.5.  Ok for mainline?
> 
> 
> 
> 2006-02-09  Roger Sayle  <roger@eyesopen.com>
> 
> 	* gcc.dg/single-precision-constant.c: Compile with -std=gnu99
> 	to obtain declaration of ISO C99's isinf on some platforms.
> 
> 
> Index: single-precision-constant.c
> ===================================================================
> *** single-precision-constant.c	(revision 110762)
> --- single-precision-constant.c	(working copy)
> ***************
> *** 1,8 ****
>   /* Test that double precision constants are correctly handled
>      when code is compiled with -fsingle-precision-constant */
>   /* Origin: Carlos O'Donell <carlos@codesourcery.com> */
>   /* { dg-do run } */
> ! /* { dg-options "-fsingle-precision-constant" } */
>   #include <math.h>
>   #include <float.h>
> 
> --- 1,10 ----
>   /* Test that double precision constants are correctly handled
>      when code is compiled with -fsingle-precision-constant */
> + /* The -std=gnu99 is needed to get isinf from <math.h> on some
> +    platforms, including mips-sgi-irix6.5.  */
>   /* Origin: Carlos O'Donell <carlos@codesourcery.com> */
>   /* { dg-do run } */
> ! /* { dg-options "-std=gnu99 -fsingle-precision-constant" } */
>   #include <math.h>
>   #include <float.h>
> 
> 
> Roger
> --
> 

-- 
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]