From 4fec64b07b9da385b80e89f86c603cb13c90c56c Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 24 Jul 2006 00:19:45 +0000 Subject: [PATCH] re PR libfortran/25289 (Cannot handle record numbers large than huge(0_4)) 2006-07-23 Jerry DeLisle 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 | 13 ++++++++++++- gcc/fortran/gfortran.h | 1 + gcc/fortran/ioparm.def | 2 +- gcc/fortran/trans-io.c | 5 +++++ gcc/fortran/trans-types.c | 15 +++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 13ba6113660..df09fcb3052 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,17 @@ +2006-07-23 Jerry DeLisle + + 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 - PR fortran/28439 + PR fortran/28439 * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition once. 2006-07-16 Jakub Jelinek diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 21b0d09b066..37d70f393ae 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -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); diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index 0fe9a7b45bf..977e4f030d4 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -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) diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 70b93682d7f..2c8e3e66bf7 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -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; diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 7c481505d20..4d20b83a365 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -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;