OSDN Git Service

PR fortran/20058
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Feb 2005 00:38:12 +0000 (00:38 +0000)
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Feb 2005 00:38:12 +0000 (00:38 +0000)
* 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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95643 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/primary.c
gcc/fortran/trans-types.c

index f5c23a3..47211b8 100644 (file)
@@ -1,3 +1,13 @@
+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
index adbccc1..58efec9 100644 (file)
@@ -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;
index f3c51ab..b87d72a 100644 (file)
@@ -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)
index 7bd0011..3ac068c 100644 (file)
@@ -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);