This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] PR30014 INQUIRE (iolength = xx) limited to kind=4


:ADDPATCH fortran:

The attached patch changes the type to GFC_IO_INT which will either be kind=4 or kind=8 depending on the system. The patch is very straight forward. I don't see any point giving a warning if a user specifies a variable of kind=8 in a -std=f95 situation. If others feel stronger about this I will do it. The restriction is lifted in F2003

OK for 4.3 only? Since this is an enhancement really and it does mess a bit with the size of st_parameter_dt it should not go to 4.2.

Regression tested on x86-64-Linux. A test case for this will require a lot of memory and consumes time. I suggest we go without one for this. I have attached the test case that I used to check this out.

Also, while we are at it here should we go ahead and do the same for the size parameter?

2006-12-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/30014
	* ioparm.def: Define iolength parameter to be type of pointer to pintio.

2006-12-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR lingfortran/30014
	* io.h: Define iolength parameter to type GFC_IO_INT.
	* transfer.c (iolength_transfer): Cast size to GFC_IO_INT.
Index: gcc/fortran/ioparm.def
===================================================================
*** gcc/fortran/ioparm.def	(revision 119608)
--- gcc/fortran/ioparm.def	(working copy)
*************** IOPARM (inquire, convert,       1 << 30,
*** 61,67 ****
  IOPARM (dt,      common,	0,	 common)
  IOPARM (dt,      rec,		1 << 9,  intio)
  IOPARM (dt,      size,		1 << 10, pint4)
! IOPARM (dt,      iolength,	1 << 11, pint4)
  IOPARM (dt,      internal_unit_desc, 0,  parray)
  IOPARM (dt,      format,	1 << 12, char1)
  IOPARM (dt,      advance,	1 << 13, char2)
--- 61,67 ----
  IOPARM (dt,      common,	0,	 common)
  IOPARM (dt,      rec,		1 << 9,  intio)
  IOPARM (dt,      size,		1 << 10, pint4)
! IOPARM (dt,      iolength,	1 << 11, pintio)
  IOPARM (dt,      internal_unit_desc, 0,  parray)
  IOPARM (dt,      format,	1 << 12, char1)
  IOPARM (dt,      advance,	1 << 13, char2)
Index: libgfortran/io/io.h
===================================================================
*** libgfortran/io/io.h	(revision 119608)
--- libgfortran/io/io.h	(working copy)
*************** typedef struct st_parameter_dt
*** 354,360 ****
  {
    st_parameter_common common;
    GFC_IO_INT rec;
!   GFC_INTEGER_4 *size, *iolength;
    gfc_array_char *internal_unit_desc;
    CHARACTER1 (format);
    CHARACTER2 (advance);
--- 354,361 ----
  {
    st_parameter_common common;
    GFC_IO_INT rec;
!   GFC_INTEGER_4 *size;
!   GFC_IO_INT *iolength;
    gfc_array_char *internal_unit_desc;
    CHARACTER1 (format);
    CHARACTER2 (advance);
Index: libgfortran/io/transfer.c
===================================================================
*** libgfortran/io/transfer.c	(revision 119608)
--- libgfortran/io/transfer.c	(working copy)
*************** iolength_transfer (st_parameter_dt *dtp,
*** 2615,2621 ****
  		   size_t size, size_t nelems)
  {
    if ((dtp->common.flags & IOPARM_DT_HAS_IOLENGTH) != 0)
!     *dtp->iolength += (GFC_INTEGER_4) size * nelems;
  }
  
  
--- 2615,2621 ----
  		   size_t size, size_t nelems)
  {
    if ((dtp->common.flags & IOPARM_DT_HAS_IOLENGTH) != 0)
!     *dtp->iolength += (GFC_IO_INT) size * nelems;
  }
  
  
program subrecord
  integer, parameter :: arraydim = huge(1_4)/16
  real, dimension(arraydim) :: array
  integer :: x
  integer(kind=8) :: recl

  inquire (iolength = recl) array,x,array,x,array,x,array,x,x,x
  print *, "record size =", recl

end program subrecord

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]