re PR libfortran/25289 (Cannot handle record numbers large than huge(0_4))
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 24 Jul 2006 00:19:45 +0000 (00:19 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 24 Jul 2006 00:19:45 +0000 (00:19 +0000)
2006-07-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/25289
* gfortran.h: Declare gfc_large_io_int_kind.
* trans-types.c (gfc_init_kinds): Set gfc_large_io_int_kind
to size 8 or 4.
* trans-io.c (enum iofield_type): Add large_io_int type.
(gfc_build_st_parameter): Same.
(gfc_build_io_library_fndecls): Same.
* ioparm_def: Use large_io_int to define rec.

From-SVN: r115700

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/ioparm.def
gcc/fortran/trans-io.c
gcc/fortran/trans-types.c

index 13ba61136604306020cf99bc5ccf3ccede84d261..df09fcb3052f1d8cc56639420737343cc84d63f8 100644 (file)
@@ -1,6 +1,17 @@
+2006-07-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/25289
+       * gfortran.h: Declare gfc_large_io_int_kind.
+       * trans-types.c (gfc_init_kinds): Set gfc_large_io_int_kind
+       to size 8 or 4.
+       * trans-io.c (enum iofield_type): Add large_io_int type.
+       (gfc_build_st_parameter): Same.
+       (gfc_build_io_library_fndecls): Same.
+       * ioparm_def: Use large_io_int to define rec.
+
 2006-07-22  Steven Bosscher  <steven@gcc.gnu.org> 
 
-       PR fortran/28439
+    PR fortran/28439
        * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once.
 
 2006-07-16  Jakub Jelinek  <jakub@redhat.com>
index 21b0d09b06610b1ad50597c48c09f0506ae19feb..37d70f393aeda525c194ae37bff950e06ecece50 100644 (file)
@@ -1806,6 +1806,7 @@ extern int gfc_default_character_kind;
 extern int gfc_default_logical_kind;
 extern int gfc_default_complex_kind;
 extern int gfc_c_int_kind;
+extern int gfc_large_io_int_kind;
 
 /* symbol.c */
 void gfc_clear_new_implicit (void);
index 0fe9a7b45bfd94ffc28718e04e21d09d4b72b0ef..977e4f030d4999770eae6c0c470a6e22e2a9c533 100644 (file)
@@ -58,7 +58,7 @@ IOPARM (inquire, convert,       1 << 29, char1)
 #define IOPARM_dt_namelist_read_mode   (1 << 8)
 #endif
 IOPARM (dt,      common,       0,       common)
-IOPARM (dt,      rec,          1 << 9,  int4)
+IOPARM (dt,      rec,          1 << 9,  large_io_int)
 IOPARM (dt,      size,         1 << 10, pint4)
 IOPARM (dt,      iolength,     1 << 11, pint4)
 IOPARM (dt,      internal_unit_desc, 0,  parray)
index 70b93682d7f48d3a0905298f66ed0d61028a41c5..2c8e3e66bf7046da6c16d7ba2b55282f189c57c1 100644 (file)
@@ -52,6 +52,7 @@ enum ioparam_type
 enum iofield_type
 {
   IOPARM_type_int4,
+  IOPARM_type_large_io_int,
   IOPARM_type_pint4,
   IOPARM_type_pchar,
   IOPARM_type_parray,
@@ -168,6 +169,7 @@ gfc_build_st_parameter (enum ioparam_type ptype, tree *types)
       switch (p->type)
        {
        case IOPARM_type_int4:
+       case IOPARM_type_large_io_int:
        case IOPARM_type_pint4:
        case IOPARM_type_parray:
        case IOPARM_type_pchar:
@@ -214,12 +216,15 @@ void
 gfc_build_io_library_fndecls (void)
 {
   tree types[IOPARM_type_num], pad_idx, gfc_int4_type_node;
+  tree gfc_large_io_int_type_node;
   tree parm_type, dt_parm_type;
   tree gfc_c_int_type_node;
   HOST_WIDE_INT pad_size;
   enum ioparam_type ptype;
 
   types[IOPARM_type_int4] = gfc_int4_type_node = gfc_get_int_type (4);
+  types[IOPARM_type_large_io_int] = gfc_large_io_int_type_node
+                           = gfc_get_int_type (gfc_large_io_int_kind);
   types[IOPARM_type_pint4] = build_pointer_type (gfc_int4_type_node);
   types[IOPARM_type_parray] = pchar_type_node;
   types[IOPARM_type_pchar] = pchar_type_node;
index 7c481505d207ff91974cb74074199237b0130137..4d20b83a3654a837728f0b2dbc794951e2523cf1 100644 (file)
@@ -93,6 +93,10 @@ int gfc_default_logical_kind;
 int gfc_default_complex_kind;
 int gfc_c_int_kind;
 
+/* The kind size used for record offsets. If the target system supports
+   kind=8, this will be set to 8, otherwise it is set to 4.  */
+int gfc_large_io_int_kind; 
+
 /* Query the target to determine which machine modes are available for
    computation.  Choose KIND numbers for them.  */
 
@@ -140,6 +144,17 @@ gfc_init_kinds (void)
       i_index += 1;
     }
 
+  /* Set the kind used to match GFC_LARGE_IO_INT in libgfortran.  This is 
+     used for large file access.  */
+
+  if (saw_i8)
+    gfc_large_io_int_kind = 8;
+  else
+    gfc_large_io_int_kind = 4;
+
+  /* If we do not at least have kind = 4, everything is pointless.  */  
+  gcc_assert(saw_i4);  
+
   /* Set the maximum integer kind.  Used with at least BOZ constants.  */
   gfc_max_integer_kind = gfc_integer_kinds[i_index - 1].kind;