File gcc48-remove-mpfr-2.4.0-requirement.patch of Package gcc7

Index: configure.ac
===================================================================
--- configure.ac	(revision 216911)
+++ configure.ac	(working copy)
@@ -1454,7 +1454,7 @@ if test -d ${srcdir}/gcc && test "x$have
     AC_MSG_CHECKING([for the correct version of mpfr.h])
     AC_TRY_COMPILE([#include <gmp.h>
     #include <mpfr.h>],[
-    #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
+    #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
     choke me
     #endif
     ], [AC_TRY_COMPILE([#include <gmp.h>
Index: configure
===================================================================
--- configure	(revision 216911)
+++ configure	(working copy)
@@ -5524,7 +5524,7 @@ int
 main ()
 {
 
-    #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
+    #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
     choke me
     #endif
 
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c	(revision 216911)
+++ gcc/fortran/simplify.c	(working copy)
@@ -4278,10 +4278,7 @@ gfc_simplify_mod (gfc_expr *a, gfc_expr
 	    return &gfc_bad_expr;
 	  }
 
-	gfc_set_model_kind (kind);
-	mpfr_fmod (result->value.real, a->value.real, p->value.real,
-		   GFC_RND_MODE);
-	break;
+	return NULL;
 
       default:
 	gfc_internal_error ("gfc_simplify_mod(): Bad arguments");
@@ -4327,19 +4324,7 @@ gfc_simplify_modulo (gfc_expr *a, gfc_ex
 	    return &gfc_bad_expr;
 	  }
 
-	gfc_set_model_kind (kind);
-	mpfr_fmod (result->value.real, a->value.real, p->value.real,
-		   GFC_RND_MODE);
-	if (mpfr_cmp_ui (result->value.real, 0) != 0)
-	  {
-	    if (mpfr_signbit (a->value.real) != mpfr_signbit (p->value.real))
-	      mpfr_add (result->value.real, result->value.real, p->value.real,
-			GFC_RND_MODE);
-	  }
-	else
-	  mpfr_copysign (result->value.real, result->value.real,
-			 p->value.real, GFC_RND_MODE);
-	break;
+	return NULL;
 
       default:
 	gfc_internal_error ("gfc_simplify_modulo(): Bad arguments");
Index: gcc/ubsan.c
===================================================================
--- gcc/ubsan.c.orig	2015-06-01 14:52:11.717105684 +0200
+++ gcc/ubsan.c	2015-06-01 14:52:26.945253071 +0200
@@ -1564,40 +1564,6 @@
 	  min = build_real (expr_type, minval2);
 	}
     }
-  else if (REAL_MODE_FORMAT (mode)->b == 10)
-    {
-      /* For _Decimal128 up to 34 decimal digits, - sign,
-	 dot, e, exponent.  */
-      char buf[64];
-      mpfr_t m;
-      int p = REAL_MODE_FORMAT (mode)->p;
-      REAL_VALUE_TYPE maxval, minval;
-
-      /* Use mpfr_snprintf rounding to compute the smallest
-	 representable decimal number greater or equal than
-	 1 << (prec - !uns_p).  */
-      mpfr_init2 (m, prec + 2);
-      mpfr_set_ui_2exp (m, 1, prec - !uns_p, GMP_RNDN);
-      mpfr_snprintf (buf, sizeof buf, "%.*RUe", p - 1, m);
-      decimal_real_from_string (&maxval, buf);
-      max = build_real (expr_type, maxval);
-
-      /* For unsigned, assume -1.0 is always representable.  */
-      if (uns_p)
-	min = build_minus_one_cst (expr_type);
-      else
-	{
-	  /* Use mpfr_snprintf rounding to compute the largest
-	     representable decimal number less or equal than
-	     (-1 << (prec - 1)) - 1.  */
-	  mpfr_set_si_2exp (m, -1, prec - 1, GMP_RNDN);
-	  mpfr_sub_ui (m, m, 1, GMP_RNDN);
-	  mpfr_snprintf (buf, sizeof buf, "%.*RDe", p - 1, m);
-	  decimal_real_from_string (&minval, buf);
-	  min = build_real (expr_type, minval);
-	}
-      mpfr_clear (m);
-    }
   else
     return NULL_TREE;
 
Index: gcc/gimple-ssa-sprintf.c
===================================================================
--- gcc/gimple-ssa-sprintf.c	(revision 257728)
+++ gcc/gimple-ssa-sprintf.c	(working copy)
@@ -1637,18 +1637,7 @@ get_mpfr_format_length (mpfr_ptr x, cons
 	p = 1024;
     }
 
-  len = mpfr_snprintf (NULL, 0, fmtstr, (int)p, x);
-
-  /* Handle the unlikely (impossible?) error by returning more than
-     the maximum dictated by the function's return type.  */
-  if (len < 0)
-    return target_dir_max () + 1;
-
-  /* Adjust the return value by the difference.  */
-  if (p < prec)
-    len += prec - p;
-
-  return len;
+  return target_dir_max () + 1;
 }
 
 /* Return the number of bytes to format using the format specifier

Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c	(revision 257983)
+++ gcc/fortran/simplify.c	(working copy)
@@ -1745,51 +1745,6 @@ simplify_trig_call (gfc_expr *icall)
     }
 }
 
-/* Convert a floating-point number from radians to degrees.  */
-
-static void
-degrees_f (mpfr_t x, mp_rnd_t rnd_mode)
-{
-  mpfr_t tmp;
-  mpfr_init (tmp);
-
-  /* Set x = x % 2pi to avoid offsets with large angles.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_mul_ui (tmp, tmp, 2, rnd_mode);
-  mpfr_fmod (tmp, x, tmp, rnd_mode);
-
-  /* Set x = x * 180.  */
-  mpfr_mul_ui (x, x, 180, rnd_mode);
-
-  /* Set x = x / pi.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_div (x, x, tmp, rnd_mode);
-
-  mpfr_clear (tmp);
-}
-
-/* Convert a floating-point number from degrees to radians.  */
-
-static void
-radians_f (mpfr_t x, mp_rnd_t rnd_mode)
-{
-  mpfr_t tmp;
-  mpfr_init (tmp);
-
-  /* Set x = x % 360 to avoid offsets with large angles.  */
-  mpfr_set_ui (tmp, 360, rnd_mode);
-  mpfr_fmod (tmp, x, tmp, rnd_mode);
-
-  /* Set x = x * pi.  */
-  mpfr_const_pi (tmp, rnd_mode);
-  mpfr_mul (x, x, tmp, rnd_mode);
-
-  /* Set x = x / 180.  */
-  mpfr_div_ui (x, x, 180, rnd_mode);
-
-  mpfr_clear (tmp);
-}
-
 
 /* Convert argument to radians before calling a trig function.  */
 
@@ -1803,12 +1758,7 @@ gfc_simplify_trigd (gfc_expr *icall)
   if (arg->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_trigd(): Bad type");
 
-  if (arg->expr_type == EXPR_CONSTANT)
-    /* Convert constant to radians before passing off to simplifier.  */
-    radians_f (arg->value.real, GFC_RND_MODE);
-
-  /* Let the usual simplifier take over - we just simplified the arg.  */
-  return simplify_trig_call (icall);
+  return NULL;
 }
 
 /* Convert result of an inverse trig function to degrees.  */
@@ -1816,21 +1766,9 @@ gfc_simplify_trigd (gfc_expr *icall)
 gfc_expr *
 gfc_simplify_atrigd (gfc_expr *icall)
 {
-  gfc_expr *result;
-
   if (icall->value.function.actual->expr->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_atrigd(): Bad type");
 
-  /* See if another simplifier has work to do first.  */
-  result = simplify_trig_call (icall);
-
-  if (result && result->expr_type == EXPR_CONSTANT)
-    {
-      /* Convert constant to degrees after passing off to actual simplifier.  */
-      degrees_f (result->value.real, GFC_RND_MODE);
-      return result;
-    }
-
   /* Let gfc_resolve_atrigd take care of the non-constant case.  */
   return NULL;
 }
@@ -1840,21 +1778,9 @@ gfc_simplify_atrigd (gfc_expr *icall)
 gfc_expr *
 gfc_simplify_atan2d (gfc_expr *y, gfc_expr *x)
 {
-  gfc_expr *result;
-
   if (x->ts.type != BT_REAL || y->ts.type != BT_REAL)
     gfc_internal_error ("in gfc_simplify_atan2d(): Bad type");
 
-  if (x->expr_type == EXPR_CONSTANT && y->expr_type == EXPR_CONSTANT)
-    {
-      result = gfc_simplify_atan2 (y, x);
-      if (result != NULL)
-	{
-	  degrees_f (result->value.real, GFC_RND_MODE);
-	  return result;
-	}
-    }
-
   /* Let gfc_resolve_atan2d take care of the non-constant case.  */
   return NULL;
 }