Commit f4e7375a by Steven G. Kargl

re PR fortran/20058 (Error on kind 16 hex data statement)

PR fortran/20058
* trans-types.c (gfc_max_integer_kind): Declare
  (gfc_init_kinds): Initialize it.
* gfortran.h (gfc_max_integer_kind): extern it.
* primary.c (match_boz_constant): Use it; remove gfortran extension
  of kind suffixes on BOZ literal constants

From-SVN: r95643
parent c7861585
2005-02-27 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/20058
* trans-types.c (gfc_max_integer_kind): Declare
(gfc_init_kinds): Initialize it.
* gfortran.h (gfc_max_integer_kind): extern it.
* primary.c (match_boz_constant): Use it; remove gfortran extension
of kind suffixes on BOZ literal constants
2005-02-27 Steven G. Kargl <kargls@comcast.net>
* arith.c (gfc_check_real_range): Remove multiple returns
......
......@@ -1556,6 +1556,7 @@ void gfc_arith_done_1 (void);
int gfc_validate_kind (bt, int, bool);
extern int gfc_index_integer_kind;
extern int gfc_default_integer_kind;
extern int gfc_max_integer_kind;
extern int gfc_default_real_kind;
extern int gfc_default_double_kind;
extern int gfc_default_character_kind;
......
......@@ -300,17 +300,15 @@ match_boz_constant (gfc_expr ** result)
match_digits (0, radix, buffer);
gfc_next_char (); /* Eat delimiter. */
kind = get_kind ();
if (kind == -1)
return MATCH_ERROR;
if (kind == -2)
kind = gfc_default_integer_kind;
else if (pedantic
&& (gfc_notify_std (GFC_STD_GNU, "Extension: Kind parameter "
"suffix to boz literal constant at %C.")
== FAILURE))
return MATCH_ERROR;
/* In section 5.2.5 and following C567 in the Fortran 2003 standard, we find
"If a data-stmt-constant is a boz-literal-constant, the corresponding
variable shall be of type integer. The boz-literal-constant is treated
as if it were an int-literal-constant with a kind-param that specifies
the representation method with the largest decimal exponent range
supported by the processor." */
kind = gfc_max_integer_kind;
e = gfc_convert_integer (buffer, kind, radix, &gfc_current_locus);
if (gfc_range_check (e) != ARITH_OK)
......
......@@ -81,6 +81,7 @@ int gfc_index_integer_kind;
/* The default kinds of the various types. */
int gfc_default_integer_kind;
int gfc_max_integer_kind;
int gfc_default_real_kind;
int gfc_default_double_kind;
int gfc_default_character_kind;
......@@ -135,6 +136,9 @@ gfc_init_kinds (void)
i_index += 1;
}
/* Set the maximum integer kind. Used with at least BOZ constants. */
gfc_max_integer_kind = gfc_integer_kinds[i_index - 1].kind;
for (r_index = 0, mode = MIN_MODE_FLOAT; mode <= MAX_MODE_FLOAT; mode++)
{
const struct real_format *fmt = REAL_MODE_FORMAT (mode);
......
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