summaryrefslogtreecommitdiff
path: root/gcc/real.c
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-14 14:47:34 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-14 14:47:34 +0000
commita12aa4cc9c246f2649e4fed2bc1d8966f2752162 (patch)
tree2fc1ab45d0c4ac31ac1612b0378da95cc6082deb /gcc/real.c
parent0dd8cf9cc8350069e94a624959d1ad4487c46a8c (diff)
downloadgcc-a12aa4cc9c246f2649e4fed2bc1d8966f2752162.tar.gz
Fix x86 bootstrap problem; from_array was being use to convert
real/int and was using a wide int larger that max_int. We create a type large enough for real.c to use. Add assertion checking to ensure it doesn't happen again. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@206601 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r--gcc/real.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/real.c b/gcc/real.c
index b060497dd01..51d18685d96 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -1377,10 +1377,12 @@ real_to_integer (const REAL_VALUE_TYPE *r)
wide_int
real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision)
{
+ typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION * 2) real_int;
HOST_WIDE_INT val[2 * MAX_BITSIZE_MODE_ANY_INT / HOST_BITS_PER_WIDE_INT];
int exp;
int words;
wide_int result;
+ real_int tmp;
int w;
switch (r->cl)
@@ -1440,10 +1442,10 @@ real_to_integer (const REAL_VALUE_TYPE *r, bool *fail, int precision)
}
#endif
w = SIGSZ * HOST_BITS_PER_LONG + words * HOST_BITS_PER_WIDE_INT;
- result = wide_int::from_array
+ tmp = real_int::from_array
(val, (w + HOST_BITS_PER_WIDE_INT - 1) / HOST_BITS_PER_WIDE_INT, w);
- result = wi::lrshift (result, (words * HOST_BITS_PER_WIDE_INT) - exp);
- result = wide_int::from (result, precision, UNSIGNED);
+ tmp = wi::lrshift<real_int> (tmp, (words * HOST_BITS_PER_WIDE_INT) - exp);
+ result = wide_int::from (tmp, precision, UNSIGNED);
if (r->sign)
return -result;