Commit a47564c8 by Roger Sayle Committed by Roger Sayle

re PR middle-end/21781 (real.c incorrectly values zero with a large exponent)


	PR middle-end/21781
	* real.c (real_from_string): If the mantissa is zero, don't bother
	parsing the exponent as the result should always be zero.

	* gcc.dg/real-const-1.c: New test case.

From-SVN: r112136
parent 349f4ea1
2006-03-16 Roger Sayle <roger@eyesopen.com>
PR middle-end/21781
* real.c (real_from_string): If the mantissa is zero, don't bother
parsing the exponent as the result should always be zero.
2006-03-16 Andreas Krebbel <krebbel1@de.ibm.com> 2006-03-16 Andreas Krebbel <krebbel1@de.ibm.com>
* simplify-rtx.c (simplify_plus_minus): Simplify within CONST terms. * simplify-rtx.c (simplify_plus_minus): Simplify within CONST terms.
......
...@@ -1862,6 +1862,11 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) ...@@ -1862,6 +1862,11 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str)
str++; str++;
} }
} }
/* If the mantissa is zero, ignore the exponent. */
if (!cmp_significand_0 (r))
goto underflow;
if (*str == 'p' || *str == 'P') if (*str == 'p' || *str == 'P')
{ {
bool exp_neg = false; bool exp_neg = false;
...@@ -1934,6 +1939,10 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) ...@@ -1934,6 +1939,10 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str)
} }
} }
/* If the mantissa is zero, ignore the exponent. */
if (r->cl == rvc_zero)
goto underflow;
if (*str == 'e' || *str == 'E') if (*str == 'e' || *str == 'E')
{ {
bool exp_neg = false; bool exp_neg = false;
......
2006-03-16 Roger Sayle <roger@eyesopen.com>
PR middle-end/21781
* gcc.dg/real-const-1.c: New test case.
2006-03-15 Geoffrey Keating <geoffk@apple.com> 2006-03-15 Geoffrey Keating <geoffk@apple.com>
* g++.old-deja/g++.other/init18.C: New. * g++.old-deja/g++.other/init18.C: New.
/* PR middle-end/21781. */
/* { dg-do compile } */
int f[.0e200000000 == 0?1:-1];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment