[Patch, fortran] PR25289 Cannot handle record numbers large than huge(0_4)

Jerry DeLisle jvdelisle@verizon.net
Mon Jun 19 07:10:00 GMT 2006


:ADDPATCH fortran:

Jerry DeLisle wrote:
> Hi All,
> 
> The attached patch fixes this bug on i686-pc-linux-gnu.
> 
> I would appreciate this getting tested on some other platforms.
> 
> The patch converts the record number used for direct I/O to type 
> gfc_offset in the library and on the front end changes the type to int8 
> to match.
> 
> This has been regression tested, NIST tested, and large IO tested.
> 
> OK for trunk and then later 4.1?
> 
> Regards,
> 
> Jerry
> 
> 2006-06-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
> 
>     PR fortran/25289
>     trans-io.c (iofield_type): Add IOPARM_type_int8.
>     (gfc_build_st_parameter): Same.
>     (gfc_build_io_library_fndecls): Same.
>     ioparm.def: Change IOPARM dt->rec to int8.
>     
>     PR libgfortran/25289
>     io.h (st_parameter_dt): Change rec type to gfc_offset.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: gcc/fortran/trans-io.c
> ===================================================================
> *** gcc/fortran/trans-io.c	(revision 114758)
> --- gcc/fortran/trans-io.c	(working copy)
> *************** enum ioparam_type
> *** 52,57 ****
> --- 52,58 ----
>   enum iofield_type
>   {
>     IOPARM_type_int4,
> +   IOPARM_type_int8,
>     IOPARM_type_pint4,
>     IOPARM_type_pchar,
>     IOPARM_type_parray,
> *************** gfc_build_st_parameter (enum ioparam_typ
> *** 168,173 ****
> --- 169,175 ----
>         switch (p->type)
>   	{
>   	case IOPARM_type_int4:
> + 	case IOPARM_type_int8:
>   	case IOPARM_type_pint4:
>   	case IOPARM_type_parray:
>   	case IOPARM_type_pchar:
> *************** void
> *** 214,225 ****
> --- 216,229 ----
>   gfc_build_io_library_fndecls (void)
>   {
>     tree types[IOPARM_type_num], pad_idx, gfc_int4_type_node;
> +   tree gfc_int8_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_int8] = gfc_int8_type_node = gfc_get_int_type (8);
>     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: gcc/fortran/ioparm.def
> ===================================================================
> *** gcc/fortran/ioparm.def	(revision 114758)
> --- gcc/fortran/ioparm.def	(working copy)
> *************** IOPARM (inquire, convert,       1 << 29,
> *** 58,64 ****
>   #define IOPARM_dt_namelist_read_mode	(1 << 8)
>   #endif
>   IOPARM (dt,      common,	0,	 common)
> ! IOPARM (dt,      rec,		1 << 9,  int4)
>   IOPARM (dt,      size,		1 << 10, pint4)
>   IOPARM (dt,      iolength,	1 << 11, pint4)
>   IOPARM (dt,      internal_unit_desc, 0,  parray)
> --- 58,64 ----
>   #define IOPARM_dt_namelist_read_mode	(1 << 8)
>   #endif
>   IOPARM (dt,      common,	0,	 common)
> ! IOPARM (dt,      rec,		1 << 9,  int8)
>   IOPARM (dt,      size,		1 << 10, pint4)
>   IOPARM (dt,      iolength,	1 << 11, pint4)
>   IOPARM (dt,      internal_unit_desc, 0,  parray)
> Index: libgfortran/io/io.h
> ===================================================================
> *** libgfortran/io/io.h	(revision 114758)
> --- libgfortran/io/io.h	(working copy)
> *************** struct format_data;
> *** 355,361 ****
>   typedef struct st_parameter_dt
>   {
>     st_parameter_common common;
> !   GFC_INTEGER_4 rec;
>     GFC_INTEGER_4 *size, *iolength;
>     gfc_array_char *internal_unit_desc;
>     CHARACTER1 (format);
> --- 355,361 ----
>   typedef struct st_parameter_dt
>   {
>     st_parameter_common common;
> !   gfc_offset rec;
>     GFC_INTEGER_4 *size, *iolength;
>     gfc_array_char *internal_unit_desc;
>     CHARACTER1 (format);



More information about the Gcc-patches mailing list