diff mbox series

PR 44292 Enable large record lengths in OPEN and INQUIRE statements

Message ID 1510952711-14976-1-git-send-email-blomqvist.janne@gmail.com
State New
Headers show
Series PR 44292 Enable large record lengths in OPEN and INQUIRE statements | expand

Commit Message

Janne Blomqvist Nov. 17, 2017, 9:05 p.m. UTC
This is a straightforward change that we can do now that the ABI has
been bumped (again!).

Regtested on x86_64-pc-linux-gnu, Ok for trunk?

gcc/fortran/ChangeLog:

2017-11-17  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/44292
	* ioparm.def (IOPARM): Make recl_in intio, and recl_out pintio.

libgfortran/ChangeLog:

2017-11-17  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/44292
	* io/io.h: Make recl_in a GC_IO_INT and recl_out a type
	GFC_IO_INT*.

gcc/testsuite/ChangeLog:

2017-11-17  Janne Blomqvist  <jb@gcc.gnu.org>

	PR fortran/44292
	* gfortran.dg/large_recl.f90: New test.
---
 gcc/fortran/ioparm.def                   |  4 ++--
 gcc/testsuite/gfortran.dg/large_recl.f90 | 12 ++++++++++++
 libgfortran/io/io.h                      |  6 +++---
 3 files changed, 17 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/large_recl.f90

Comments

Thomas Koenig Nov. 18, 2017, 3:56 p.m. UTC | #1
Hi Janne,

> This is a straightforward change that we can do now that the ABI has
> been bumped (again!).
> 
> Regtested on x86_64-pc-linux-gnu, Ok for trunk?

OK, and thanks.

Regards

	Thomas
Janne Blomqvist Nov. 18, 2017, 4:20 p.m. UTC | #2
On Sat, Nov 18, 2017 at 5:56 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Janne,
>
>> This is a straightforward change that we can do now that the ABI has
>> been bumped (again!).
>>
>> Regtested on x86_64-pc-linux-gnu, Ok for trunk?
>
>
> OK, and thanks.
>
> Regards
>
>         Thomas

Thanks, committed as r254915. Though I did notice some places in the
I/O library where we're incorrectly using the int type, so while this
patch takes care of the ABI issue large RECL's don't actually work in
all cases yet. I'm preparing a patch to fix the issues I discovered.
diff mbox series

Patch

diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def
index ca5631b..5fc04bc 100644
--- a/gcc/fortran/ioparm.def
+++ b/gcc/fortran/ioparm.def
@@ -34,7 +34,7 @@  IOPARM (common,  line,		0,	 int4)
 IOPARM (common,  iomsg,		1 << 6,  char2)
 IOPARM (common,  iostat,	1 << 5,  pint4)
 IOPARM (open,    common,	0,	 common)
-IOPARM (open,    recl_in,	1 << 7,  int4)
+IOPARM (open,    recl_in,	1 << 7,  intio)
 IOPARM (open,    file,		1 << 8,  char2)
 IOPARM (open,    status,	1 << 9,  char1)
 IOPARM (open,    access,	1 << 10, char2)
@@ -63,7 +63,7 @@  IOPARM (inquire, opened,	1 << 8,  pint4)
 IOPARM (inquire, number,	1 << 9,  pint4)
 IOPARM (inquire, named,		1 << 10, pint4)
 IOPARM (inquire, nextrec,	1 << 11, pint4)
-IOPARM (inquire, recl_out,	1 << 12, pint4)
+IOPARM (inquire, recl_out,	1 << 12, pintio)
 IOPARM (inquire, strm_pos_out,	1 << 13, pintio)
 IOPARM (inquire, file,		1 << 14, char1)
 IOPARM (inquire, access,	1 << 15, char2)
diff --git a/gcc/testsuite/gfortran.dg/large_recl.f90 b/gcc/testsuite/gfortran.dg/large_recl.f90
new file mode 100644
index 0000000..97ac63f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/large_recl.f90
@@ -0,0 +1,12 @@ 
+! { dg-do run }
+! PR 44292 Large RECL=
+program large_recl
+  implicit none
+  integer(kind=8) :: r
+  open(10, status="scratch", recl=12345678901_8, form="unformatted", access="direct")
+  inquire(10, recl=r)
+  close(10, status="delete")
+  if (r /= 12345678901_8) then
+     call abort()
+  end if
+end program large_recl
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index df49157..3330bce 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -308,7 +308,7 @@  unit_sign_s;
 typedef struct
 {
   st_parameter_common common;
-  GFC_INTEGER_4 recl_in;
+  GFC_IO_INT recl_in;
   CHARACTER2 (file);
   CHARACTER1 (status);
   CHARACTER2 (access);
@@ -388,8 +388,8 @@  typedef struct
 {
   st_parameter_common common;
   GFC_INTEGER_4 *exist, *opened, *number, *named;
-  GFC_INTEGER_4 *nextrec, *recl_out;
-  GFC_IO_INT *strm_pos_out;
+  GFC_INTEGER_4 *nextrec;
+  GFC_IO_INT  *recl_out, *strm_pos_out;
   CHARACTER1 (file);
   CHARACTER2 (access);
   CHARACTER1 (form);