[PATCH] Fix PR bootstrap/26055

Richard Guenther rguenther@suse.de
Wed Feb 8 10:25:00 GMT 2006


(I realized I never really submitted this patch)
This patch fixes the bootstrap problem for targets whose math.h conflict
with libgcc-math internals.  Fixed by not including the target math.h at
all, which we really don't need.  This patch also enables -Werror and
removes -ffinite-math-only (because we use isless/isgreater/isnan etc.).

It has been bootstrapped on x86_64-unknown-linux-gnu and i686-pc-linux-gnu
and reportedly fixed the bootstrap problem for i386-apple-darwin8.4.1.

Ok for mainline?

Thanks,
Richard.

:ADDPATCH libgcc-math:


2006-02-08  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/26055
	Revert
	* configure.ac: Disable libgcc-math if we cannot mix
	declaration of __isinf and math.h inclusion.
	* configure: Re-generate.

	* i386/Makefile.am: Use -std=c99, do not use -ffinite-math-only,
	do not define __NO_MATH_INLINES.  Compile with -Werror.
	* include/math_private.h (__atanf): Declare.
	* i386/Makefile.in: Re-generate.
	(__scalbnf): Likewise.
	(__floorf): Likewise.
	(__isinff): Likewise.
	(__scalbn): Likewise.
	(__floor): Likewise.
	(fabs): Likewise.
	(fabsf): Likewise.
	* flt-32/e_acosf.c: Do not include math.h
	* flt-32/s_isinff.c: Likewise.
	* flt-32/k_tanf.c: Likewise.
	* flt-32/e_sqrtf.c: Likewise.
	* flt-32/e_asinf.c: Likewise.
	* flt-32/k_cosf.c: Likewise.
	* flt-32/k_sinf.c: Likewise.
	* flt-32/s_floorf.c: Likewise.
	* flt-32/s_tanf.c: Likewise.
	* flt-32/s_atanf.c: Likewise.
	* flt-32/s_cosf.c: Likewise.
	* flt-32/e_atan2f.c: Likewise.
	* flt-32/e_powf.c: Likewise.
	* flt-32/s_sinf.c: Likewise.
	* flt-32/e_rem_pio2f.c: Likewise.
	* flt-32/s_scalbnf.c: Likewise.
	* flt-32/e_logf.c: Likewise.
	* flt-32/e_log10f.c: Likewise.
	* flt-32/k_rem_pio2f.c: Likewise.
	* flt-32/e_expf.c: Likewise.  Use __builtin_isless and
	__builtin_isgreater.
	* dbl-64/s_floor.c: Do not include math.h.
	* dbl-64/e_log10.c: Likewise.
	* dbl-64/k_rem_pio2.c: Likewise.
	* dbl-64/s_atan.c: Likewise.
	* dbl-64/s_scalbn.c: Likewise.
	* dbl-64/s_isinf.c: Likewise.
	* dbl-64/s_tan.c: Likewise.
	* dbl-64/e_rem_pio2.c: Likewise.  Avoid uninitialized variable
	warning.
	* dbl-64/mpa.c: Likewise.


Index: configure.ac
===================================================================
*** configure.ac	(revision 110745)
--- configure.ac	(working copy)
*************** fi
*** 125,149 ****
  
  GCC_HEADER_STDINT(gstdint.h)
  
- # Check for target library dependencies
- cannot_build=no
- 
- AC_MSG_CHECKING([whether math.h conflicts with defining __isinf])
- AC_TRY_LINK([
- #include "math.h"
- int __isinf (double x)
- {
- }
- ], [
- return __isinf (1.0);
- ], [
- AC_MSG_RESULT([no])
- ], [
- AC_MSG_RESULT([yes])
- cannot_build=yes
- ])
- 
- 
  # Now check which parts we include in the library.
  
  arch_subdirs=
--- 125,130 ----
*************** esac
*** 161,169 ****
  AC_SUBST(arch_subdirs)
  AC_SUBST(arch_libraries)
  AC_SUBST(arch_maps)
- if test "$cannot_build" = "yes"; then
-   arch_subdirs=
- fi
  AM_CONDITIONAL(BUILD_LIBGCC_MATH, [test "x$arch_subdirs" != x])
  
  
--- 142,147 ----
Index: include/math_private.h
===================================================================
*** include/math_private.h	(revision 110745)
--- include/math_private.h	(working copy)
*************** extern float __kernel_cosf (float,float)
*** 232,237 ****
--- 232,242 ----
  extern float __kernel_tanf (float,float,int);
  extern int   __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*);
  
+ extern float __atanf (float);
+ extern float __scalbnf (float x, int n);
+ extern float __floorf(float x);
+ extern int __isinff(float x);
+ 
  /* internal functions.  */
  extern float __copysignf (float x, float __y);
  
*************** extern double __mpcos1 (double __x);
*** 318,322 ****
--- 323,333 ----
  extern double __slowexp (double __x);
  extern double __slowpow (double __x, double __y, double __z);
  extern void __docos (double __x, double __dx, double __v[]);
+ extern double __scalbn (double x, int n);
+ extern double __floor(double x);
+ 
+ /* Prototypes for C99 math functions provided by GCC builtins.  */
+ extern double fabs(double);
+ extern float fabsf(float);
  
  #endif /* _MATH_PRIVATE_H_ */
Index: flt-32/e_acosf.c
===================================================================
*** flt-32/e_acosf.c	(revision 110745)
--- flt-32/e_acosf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_acosf.c,v 1.5 1995/05/12 04:57:16 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/s_isinff.c
===================================================================
*** flt-32/s_isinff.c	(revision 110745)
--- flt-32/s_isinff.c	(working copy)
*************** static char rcsid[] = "$NetBSD: s_isinff
*** 12,18 ****
   * no branching!
   */
  
- #include "math.h"
  #include "math_private.h"
  
  int
--- 12,17 ----
Index: flt-32/k_tanf.c
===================================================================
*** flt-32/k_tanf.c	(revision 110745)
--- flt-32/k_tanf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: k_tanf.c,v 1.4 1995/05/10 20:46:39 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  #ifdef __STDC__
  static const float 
--- 17,22 ----
Index: flt-32/e_sqrtf.c
===================================================================
*** flt-32/e_sqrtf.c	(revision 110745)
--- flt-32/e_sqrtf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_sqrtf.c,v 1.4 1995/05/10 20:46:19 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/k_cosf.c
===================================================================
*** flt-32/k_cosf.c	(revision 110745)
--- flt-32/k_cosf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: k_cosf.c,v 1.4 1995/05/10 20:46:23 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/e_asinf.c
===================================================================
*** flt-32/e_asinf.c	(revision 110745)
--- flt-32/e_asinf.c	(working copy)
***************
*** 39,45 ****
  static char rcsid[] = "$NetBSD: e_asinf.c,v 1.5 1995/05/12 04:57:25 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 39,44 ----
Index: flt-32/e_expf.c
===================================================================
*** flt-32/e_expf.c	(revision 110745)
--- flt-32/e_expf.c	(working copy)
***************
*** 52,58 ****
  #endif
  #include <float.h>
  #include <ieee754.h>
- #include <math.h>
  #include <math_private.h>
  
  extern const float __exp_deltatable[178];
--- 52,57 ----
*************** __ieee754_expf (float x)
*** 67,73 ****
    static const float himark = 88.72283935546875;
    static const float lomark = -103.972084045410;
    /* Check for usual case.  */
!   if (isless (x, himark) && isgreater (x, lomark))
      {
        static const float THREEp42 = 13194139533312.0;
        static const float THREEp22 = 12582912.0;
--- 66,72 ----
    static const float himark = 88.72283935546875;
    static const float lomark = -103.972084045410;
    /* Check for usual case.  */
!   if (__builtin_isless (x, himark) && __builtin_isgreater (x, lomark))
      {
        static const float THREEp42 = 13194139533312.0;
        static const float THREEp22 = 12582912.0;
*************** __ieee754_expf (float x)
*** 115,121 ****
        return (float) result;
      }
    /* Exceptional cases:  */
!   else if (isless (x, himark))
      {
        if (__isinff (x))
  	/* e^-inf == 0, with no error.  */
--- 114,120 ----
        return (float) result;
      }
    /* Exceptional cases:  */
!   else if (__builtin_isless (x, himark))
      {
        if (__isinff (x))
  	/* e^-inf == 0, with no error.  */
Index: flt-32/s_floorf.c
===================================================================
*** flt-32/s_floorf.c	(revision 110745)
--- flt-32/s_floorf.c	(working copy)
*************** static char rcsid[] = "$NetBSD: s_floorf
*** 26,32 ****
   *	Inexact flag raised if x not equal to floorf(x).
   */
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 26,31 ----
Index: flt-32/k_sinf.c
===================================================================
*** flt-32/k_sinf.c	(revision 110745)
--- flt-32/k_sinf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: k_sinf.c,v 1.4 1995/05/10 20:46:33 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/s_tanf.c
===================================================================
*** flt-32/s_tanf.c	(revision 110745)
--- flt-32/s_tanf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: s_tanf.c,v 1.4 1995/05/10 20:48:20 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/s_atanf.c
===================================================================
*** flt-32/s_atanf.c	(revision 110745)
--- flt-32/s_atanf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: s_atanf.c,v 1.4 1995/05/10 20:46:47 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/s_cosf.c
===================================================================
*** flt-32/s_cosf.c	(revision 110745)
--- flt-32/s_cosf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/e_powf.c
===================================================================
*** flt-32/e_powf.c	(revision 110745)
--- flt-32/e_powf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_powf.c,v 1.7 1996/04/08 15:43:44 phil Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  static const float huge = 1.0e+30, tiny = 1.0e-30;
--- 17,22 ----
Index: flt-32/e_atan2f.c
===================================================================
*** flt-32/e_atan2f.c	(revision 110745)
--- flt-32/e_atan2f.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_atan2f.c,v 1.4 1995/05/10 20:44:53 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/s_sinf.c
===================================================================
*** flt-32/s_sinf.c	(revision 110745)
--- flt-32/s_sinf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: s_sinf.c,v 1.4 1995/05/10 20:48:16 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/e_rem_pio2f.c
===================================================================
*** flt-32/e_rem_pio2f.c	(revision 110745)
--- flt-32/e_rem_pio2f.c	(working copy)
*************** static char rcsid[] = "$NetBSD: e_rem_pi
*** 23,29 ****
   * use __kernel_rem_pio2f()
   */
  
- #include "math.h"
  #include "math_private.h"
  
  /*
--- 23,28 ----
Index: flt-32/s_scalbnf.c
===================================================================
*** flt-32/s_scalbnf.c	(revision 110745)
--- flt-32/s_scalbnf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: s_scalbnf.c,v 1.4 1995/05/10 20:48:10 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/e_logf.c
===================================================================
*** flt-32/e_logf.c	(revision 110745)
--- flt-32/e_logf.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_logf.c,v 1.4 1995/05/10 20:45:54 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/e_log10f.c
===================================================================
*** flt-32/e_log10f.c	(revision 110745)
--- flt-32/e_log10f.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: e_log10f.c,v 1.5 1995/05/10 20:45:53 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 17,22 ----
Index: flt-32/k_rem_pio2f.c
===================================================================
*** flt-32/k_rem_pio2f.c	(revision 110745)
--- flt-32/k_rem_pio2f.c	(working copy)
***************
*** 17,23 ****
  static char rcsid[] = "$NetBSD: k_rem_pio2f.c,v 1.4 1995/05/10 20:46:28 jtc Exp $";
  #endif
  
- #include "math.h"
  #include "math_private.h"
  
  /* In the float version, the input parameter x contains 8 bit
--- 17,22 ----
Index: dbl-64/s_floor.c
===================================================================
*** dbl-64/s_floor.c	(revision 110745)
--- dbl-64/s_floor.c	(working copy)
*************** static char rcsid[] = "$NetBSD: s_floor.
*** 23,29 ****
   *	Inexact flag raised if x not equal to floor(x).
   */
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 23,28 ----
Index: dbl-64/e_log10.c
===================================================================
*** dbl-64/e_log10.c	(revision 110745)
--- dbl-64/e_log10.c	(working copy)
*************** static char rcsid[] = "$NetBSD: e_log10.
*** 47,53 ****
   * shown.
   */
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 47,52 ----
Index: dbl-64/k_rem_pio2.c
===================================================================
*** dbl-64/k_rem_pio2.c	(revision 110745)
--- dbl-64/k_rem_pio2.c	(working copy)
*************** static char rcsid[] = "$NetBSD: k_rem_pi
*** 130,136 ****
   * to produce the hexadecimal values shown.
   */
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 130,135 ----
Index: dbl-64/s_atan.c
===================================================================
*** dbl-64/s_atan.c	(revision 110745)
--- dbl-64/s_atan.c	(working copy)
***************
*** 42,48 ****
  #include "MathLib.h"
  #include "uatan.tbl"
  #include "atnat.h"
- #include "math.h"
  
  void __mpatan(mp_no *,mp_no *,int);          /* see definition in mpatan.c */
  static double atanMp(double,const int[]);
--- 42,47 ----
Index: dbl-64/s_scalbn.c
===================================================================
*** dbl-64/s_scalbn.c	(revision 110745)
--- dbl-64/s_scalbn.c	(working copy)
*************** static char rcsid[] = "$NetBSD: s_scalbn
*** 21,27 ****
   * exponentiation or a multiplication.
   */
  
- #include "math.h"
  #include "math_private.h"
  
  #ifdef __STDC__
--- 21,26 ----
Index: dbl-64/s_isinf.c
===================================================================
*** dbl-64/s_isinf.c	(revision 110745)
--- dbl-64/s_isinf.c	(working copy)
*************** static char rcsid[] = "$NetBSD: s_isinf.
*** 13,19 ****
   * no branching!
   */
  
- #include "math.h"
  #include "math_private.h"
  
  int
--- 13,18 ----
Index: dbl-64/mpa.c
===================================================================
*** dbl-64/mpa.c	(revision 110745)
--- dbl-64/mpa.c	(working copy)
*************** static void norm(const mp_no *x, double 
*** 132,138 ****
  #if 0
    int k;
  #endif
!   double a,c,u,v,z[5];
    if (p<5) {
      if      (p==1) c = X[1];
      else if (p==2) c = X[1] + R* X[2];
--- 132,138 ----
  #if 0
    int k;
  #endif
!   double a,c=c,u,v,z[5];
    if (p<5) {
      if      (p==1) c = X[1];
      else if (p==2) c = X[1] + R* X[2];
Index: dbl-64/e_rem_pio2.c
===================================================================
*** dbl-64/e_rem_pio2.c	(revision 110745)
--- dbl-64/e_rem_pio2.c	(working copy)
*************** static char rcsid[] = "$NetBSD: e_rem_pi
*** 20,26 ****
   * use __kernel_rem_pio2()
   */
  
- #include "math.h"
  #include "math_private.h"
  
  /*
--- 20,25 ----
*************** pio2_3t =  8.47842766036889956997e-32; /
*** 90,96 ****
  	double x,y[];
  #endif
  {
! 	double z,w,t,r,fn;
  	double tx[3];
  	int32_t e0,i,j,nx,n,ix,hx;
  	uint32_t low;
--- 89,95 ----
  	double x,y[];
  #endif
  {
! 	double z=z,w,t,r,fn;
  	double tx[3];
  	int32_t e0,i,j,nx,n,ix,hx;
  	uint32_t low;
Index: dbl-64/s_tan.c
===================================================================
*** dbl-64/s_tan.c	(revision 110745)
--- dbl-64/s_tan.c	(working copy)
***************
*** 37,43 ****
  #include "dla.h"
  #include "mpa.h"
  #include "MathLib.h"
- #include "math.h"
  
  static double tanMp(double);
  void __mptan(double, mp_no *, int);
--- 37,42 ----
Index: i386/Makefile.am
===================================================================
*** i386/Makefile.am	(revision 110745)
--- i386/Makefile.am	(working copy)
*************** gcc_version := $(shell cat $(top_srcdir)
*** 11,19 ****
  noinst_LTLIBRARIES = libsse2.la
  
  libsse2_la_CFLAGS = -I@srcdir@/../include -I.. -include @srcdir@/sse2.h \
!   -Wall -O2 -g -msse2 -msseregparm -mfpmath=sse -march=pentium3 \
!   -fno-math-errno -fno-trapping-math -ffinite-math-only \
!   -fno-rounding-math -fno-signaling-nans -D__NO_MATH_INLINES
  
  libsse2_la_SOURCES = \
    @srcdir@/../flt-32/e_acosf.c \
--- 11,19 ----
  noinst_LTLIBRARIES = libsse2.la
  
  libsse2_la_CFLAGS = -I@srcdir@/../include -I.. -include @srcdir@/sse2.h \
!   -Wall -Werror -std=c99 -O2 -g \
!   -msse2 -msseregparm -mfpmath=sse -march=pentium3 -mtune=generic \
!   -fno-math-errno -fno-trapping-math -fno-rounding-math -fno-signaling-nans
  
  libsse2_la_SOURCES = \
    @srcdir@/../flt-32/e_acosf.c \



More information about the Gcc-patches mailing list