File gcc48-remove-mpfr-2.4.0-requirement.patch of Package cross-aarch64-gcc7
248
1
Index: configure.ac
2
===================================================================
3
--- configure.ac (revision 216911)
4
+++ configure.ac (working copy)
5
6
AC_MSG_CHECKING([for the correct version of mpfr.h])
7
AC_TRY_COMPILE([#include <gmp.h>
8
#include <mpfr.h>],[
9
- #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
10
+ #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
11
choke me
12
#endif
13
], [AC_TRY_COMPILE([#include <gmp.h>
14
Index: configure
15
===================================================================
16
--- configure (revision 216911)
17
+++ configure (working copy)
18
19
main ()
20
{
21
22
- #if MPFR_VERSION < MPFR_VERSION_NUM(2,4,0)
23
+ #if MPFR_VERSION < MPFR_VERSION_NUM(2,3,1)
24
choke me
25
#endif
26
27
Index: gcc/fortran/simplify.c
28
===================================================================
29
--- gcc/fortran/simplify.c (revision 216911)
30
+++ gcc/fortran/simplify.c (working copy)
31
32
return &gfc_bad_expr;
33
}
34
35
- gfc_set_model_kind (kind);
36
- mpfr_fmod (result->value.real, a->value.real, p->value.real,
37
- GFC_RND_MODE);
38
- break;
39
+ return NULL;
40
41
default:
42
gfc_internal_error ("gfc_simplify_mod(): Bad arguments");
43
44
return &gfc_bad_expr;
45
}
46
47
- gfc_set_model_kind (kind);
48
- mpfr_fmod (result->value.real, a->value.real, p->value.real,
49
- GFC_RND_MODE);
50
- if (mpfr_cmp_ui (result->value.real, 0) != 0)
51
- {
52
- if (mpfr_signbit (a->value.real) != mpfr_signbit (p->value.real))
53
- mpfr_add (result->value.real, result->value.real, p->value.real,
54
- GFC_RND_MODE);
55
- }
56
- else
57
- mpfr_copysign (result->value.real, result->value.real,
58
- p->value.real, GFC_RND_MODE);
59
- break;
60
+ return NULL;
61
62
default:
63
gfc_internal_error ("gfc_simplify_modulo(): Bad arguments");
64
Index: gcc/ubsan.c
65
===================================================================
66
--- gcc/ubsan.c.orig 2015-06-01 14:52:11.717105684 +0200
67
+++ gcc/ubsan.c 2015-06-01 14:52:26.945253071 +0200
68
69
min = build_real (expr_type, minval2);
70
}
71
}
72
- else if (REAL_MODE_FORMAT (mode)->b == 10)
73
- {
74
- /* For _Decimal128 up to 34 decimal digits, - sign,
75
- dot, e, exponent. */
76
- char buf[64];
77
- mpfr_t m;
78
- int p = REAL_MODE_FORMAT (mode)->p;
79
- REAL_VALUE_TYPE maxval, minval;
80
-
81
- /* Use mpfr_snprintf rounding to compute the smallest
82
- representable decimal number greater or equal than
83
- 1 << (prec - !uns_p). */
84
- mpfr_init2 (m, prec + 2);
85
- mpfr_set_ui_2exp (m, 1, prec - !uns_p, GMP_RNDN);
86
- mpfr_snprintf (buf, sizeof buf, "%.*RUe", p - 1, m);
87
- decimal_real_from_string (&maxval, buf);
88
- max = build_real (expr_type, maxval);
89
-
90
- /* For unsigned, assume -1.0 is always representable. */
91
- if (uns_p)
92
- min = build_minus_one_cst (expr_type);
93
- else
94
- {
95
- /* Use mpfr_snprintf rounding to compute the largest
96
- representable decimal number less or equal than
97
- (-1 << (prec - 1)) - 1. */
98
- mpfr_set_si_2exp (m, -1, prec - 1, GMP_RNDN);
99
- mpfr_sub_ui (m, m, 1, GMP_RNDN);
100
- mpfr_snprintf (buf, sizeof buf, "%.*RDe", p - 1, m);
101
- decimal_real_from_string (&minval, buf);
102
- min = build_real (expr_type, minval);
103
- }
104
- mpfr_clear (m);
105
- }
106
else
107
return NULL_TREE;
108
109
Index: gcc/gimple-ssa-sprintf.c
110
===================================================================
111
--- gcc/gimple-ssa-sprintf.c (revision 257728)
112
+++ gcc/gimple-ssa-sprintf.c (working copy)
113
114
p = 1024;
115
}
116
117
- len = mpfr_snprintf (NULL, 0, fmtstr, (int)p, x);
118
-
119
- /* Handle the unlikely (impossible?) error by returning more than
120
- the maximum dictated by the function's return type. */
121
- if (len < 0)
122
- return target_dir_max () + 1;
123
-
124
- /* Adjust the return value by the difference. */
125
- if (p < prec)
126
- len += prec - p;
127
-
128
- return len;
129
+ return target_dir_max () + 1;
130
}
131
132
/* Return the number of bytes to format using the format specifier
133
134
Index: gcc/fortran/simplify.c
135
===================================================================
136
--- gcc/fortran/simplify.c (revision 257983)
137
+++ gcc/fortran/simplify.c (working copy)
138
139
}
140
}
141
142
-/* Convert a floating-point number from radians to degrees. */
143
-
144
-static void
145
-degrees_f (mpfr_t x, mp_rnd_t rnd_mode)
146
-{
147
- mpfr_t tmp;
148
- mpfr_init (tmp);
149
-
150
- /* Set x = x % 2pi to avoid offsets with large angles. */
151
- mpfr_const_pi (tmp, rnd_mode);
152
- mpfr_mul_ui (tmp, tmp, 2, rnd_mode);
153
- mpfr_fmod (tmp, x, tmp, rnd_mode);
154
-
155
- /* Set x = x * 180. */
156
- mpfr_mul_ui (x, x, 180, rnd_mode);
157
-
158
- /* Set x = x / pi. */
159
- mpfr_const_pi (tmp, rnd_mode);
160
- mpfr_div (x, x, tmp, rnd_mode);
161
-
162
- mpfr_clear (tmp);
163
-}
164
-
165
-/* Convert a floating-point number from degrees to radians. */
166
-
167
-static void
168
-radians_f (mpfr_t x, mp_rnd_t rnd_mode)
169
-{
170
- mpfr_t tmp;
171
- mpfr_init (tmp);
172
-
173
- /* Set x = x % 360 to avoid offsets with large angles. */
174
- mpfr_set_ui (tmp, 360, rnd_mode);
175
- mpfr_fmod (tmp, x, tmp, rnd_mode);
176
-
177
- /* Set x = x * pi. */
178
- mpfr_const_pi (tmp, rnd_mode);
179
- mpfr_mul (x, x, tmp, rnd_mode);
180
-
181
- /* Set x = x / 180. */
182
- mpfr_div_ui (x, x, 180, rnd_mode);
183
-
184
- mpfr_clear (tmp);
185
-}
186
-
187
188
/* Convert argument to radians before calling a trig function. */
189
190
191
if (arg->ts.type != BT_REAL)
192
gfc_internal_error ("in gfc_simplify_trigd(): Bad type");
193
194
- if (arg->expr_type == EXPR_CONSTANT)
195
- /* Convert constant to radians before passing off to simplifier. */
196
- radians_f (arg->value.real, GFC_RND_MODE);
197
-
198
- /* Let the usual simplifier take over - we just simplified the arg. */
199
- return simplify_trig_call (icall);
200
+ return NULL;
201
}
202
203
/* Convert result of an inverse trig function to degrees. */
204
205
gfc_expr *
206
gfc_simplify_atrigd (gfc_expr *icall)
207
{
208
- gfc_expr *result;
209
-
210
if (icall->value.function.actual->expr->ts.type != BT_REAL)
211
gfc_internal_error ("in gfc_simplify_atrigd(): Bad type");
212
213
- /* See if another simplifier has work to do first. */
214
- result = simplify_trig_call (icall);
215
-
216
- if (result && result->expr_type == EXPR_CONSTANT)
217
- {
218
- /* Convert constant to degrees after passing off to actual simplifier. */
219
- degrees_f (result->value.real, GFC_RND_MODE);
220
- return result;
221
- }
222
-
223
/* Let gfc_resolve_atrigd take care of the non-constant case. */
224
return NULL;
225
}
226
227
gfc_expr *
228
gfc_simplify_atan2d (gfc_expr *y, gfc_expr *x)
229
{
230
- gfc_expr *result;
231
-
232
if (x->ts.type != BT_REAL || y->ts.type != BT_REAL)
233
gfc_internal_error ("in gfc_simplify_atan2d(): Bad type");
234
235
- if (x->expr_type == EXPR_CONSTANT && y->expr_type == EXPR_CONSTANT)
236
- {
237
- result = gfc_simplify_atan2 (y, x);
238
- if (result != NULL)
239
- {
240
- degrees_f (result->value.real, GFC_RND_MODE);
241
- return result;
242
- }
243
- }
244
-
245
/* Let gfc_resolve_atan2d take care of the non-constant case. */
246
return NULL;
247
}
248