Commit e0bf6b33 by Jim Wilson

(yylex): Do warn about floating point out of range if target floating-point format is IEEE.

(yylex): Do warn about floating point out of range if
target floating-point format is IEEE.  Use warning instead of
pedwarn to avoid getting errors.

From-SVN: r8538
parent 9d99bd1b
...@@ -1360,24 +1360,24 @@ yylex () ...@@ -1360,24 +1360,24 @@ yylex ()
type = float_type_node; type = float_type_node;
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type)); value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT /* A diagnostic is required here by some ANSI C testsuites.
&& REAL_VALUE_ISINF (value) && pedantic) This is not pedwarn, become some people don't want
pedwarn ("floating point number exceeds range of `float'"); an error for this. */
if (REAL_VALUE_ISINF (value) && pedantic)
warning ("floating point number exceeds range of `float'");
} }
else if (lflag) else if (lflag)
{ {
type = long_double_type_node; type = long_double_type_node;
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type)); value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT if (REAL_VALUE_ISINF (value) && pedantic)
&& REAL_VALUE_ISINF (value) && pedantic) warning ("floating point number exceeds range of `long double'");
pedwarn ("floating point number exceeds range of `long double'");
} }
else else
{ {
value = REAL_VALUE_ATOF (copy, TYPE_MODE (type)); value = REAL_VALUE_ATOF (copy, TYPE_MODE (type));
if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT if (REAL_VALUE_ISINF (value) && pedantic)
&& REAL_VALUE_ISINF (value) && pedantic) warning ("floating point number exceeds range of `double'");
pedwarn ("floating point number exceeds range of `double'");
} }
set_float_handler (NULL_PTR); set_float_handler (NULL_PTR);
...@@ -1387,11 +1387,10 @@ yylex () ...@@ -1387,11 +1387,10 @@ yylex ()
{ {
/* ERANGE is also reported for underflow, /* ERANGE is also reported for underflow,
so test the value to distinguish overflow from that. */ so test the value to distinguish overflow from that. */
if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT if (REAL_VALUES_LESS (dconst1, value)
&& (REAL_VALUES_LESS (dconst1, value) || REAL_VALUES_LESS (value, dconstm1))
|| REAL_VALUES_LESS (value, dconstm1)))
{ {
pedwarn ("floating point number exceeds range of `double'"); warning ("floating point number exceeds range of `double'");
exceeds_double = 1; exceeds_double = 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