This is the mail archive of the gcc-bugs@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]

[Bug libfortran/15266] [gfortran] libgfortran doesn't compile on IRIX 5.3


------- Additional Comments From ro at techfak dot uni-bielefeld dot de  2004-05-18 13:06 -------
Subject: Re:  [gfortran] libgfortran doesn't compile on IRIX 5.3

pinskia at gcc dot gnu dot org writes:

> Yes and IIRC when IRIX (if ever) gets C99 most of everyone's code gets broken if they used csqrtf.

This is about cabs and friends on IRIX, but even so, not at all: IRIX
6.5.18 and up have C99 support, which is done like this:

<internal/math_core.h> (included from <math.h>) has

#if !defined(__c99)
struct __cabs_s { double a,b; };

extern double   cabs(struct __cabs_s);
[...]
#endif

and <complex.h> has

/* C99: 7.3.8.1 */

/* c89 also had functions cabs, cabsf and cabsl with the following
 * prototypes.
 *
 * double cabs (struct { double a,b; } z);
 * float cabsf (struct { float a,b; } z);
 * long double cabsl (struct { long double a,b; } z);
 *
 * As the passing of structs by value is different from passing
 * complex by value for the float and long double cases, the following
 * changes are being done to the C99 functions so as to maintain
 * backwards compatibility.
 * 
 * For the C99 functions we provide static definitions of these,
 * which in turn call the corresponding library functions with a __c99_
 * prefix.
 *
 * There are two drawbacks of this approach
 *
 *  1.  As each compilation will get its own copy of these functions,
 *      any program which relies on the address of these functions being
 *      unique will fail.
 *
 *  2.  If the user rolls his own version of these functions, they will
 *      never get invoked, and to get around this problem, the user
 *      should be able to disable the generation of these static functions.
 *      This is achieved by adding -D_C99_CABS_USER_DEFINED to the commandline.
 */


extern double      __c99_cabs  (double complex);
extern float       __c99_cabsf (float complex);
extern long double __c99_cabsl (long double complex);
#pragma optional   __c99_cabs
#pragma optional   __c99_cabsf
#pragma optional   __c99_cabsl

#ifdef _C99_CABS_USER_DEFINED

extern double       cabs  (double complex);
extern float        cabsf (float complex);
extern long double  cabsl (long double complex);

#else 

static inline double cabs       (double complex z)      {return __c99_cabs(z); }
static inline float  cabsf      (float complex z)       {return __c99_cabsf(z);}
static inline long double cabsl (long double complex z) {return __c99_cabsl(z);}

#endif /* _C99_CABS_USER_DEFINED */

These vendors usually know (and care) about backwards source and binary
compatibility.

	Rainer


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15266


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