From ebbd5506fa1e075d23c0ca924d11db16e8772848 Mon Sep 17 00:00:00 2001 From: jb Date: Sat, 18 Nov 2017 16:56:21 +0000 Subject: [PATCH] PR 83036 Make NEXTREC specifier for INQUIRE work for large record numbers This is accomplished by making the NEXTREC specifier be a 8 byte integer where supported. I wasn't able to come up with a testcase that does not create a large file that could be added to the testsuite, but here's one which creates a 2 GB file: program nextrec implicit none integer(8) :: ii, n open(10, file="foo.dat", recl=1, access="direct", form="unformatted", & status="replace") do ii = 1, huge(1) + 2_8 write(10, rec=ii) 'a' end do inquire(10, nextrec=n) if (n /= huge(1) + 3_8) then call abort() end if close(10, status="delete") end program nextrec Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2017-11-18 Janne Blomqvist PR fortran/83036 * ioparm.def (IOPARM): Make nextrec a pintio. libgfortran/ChangeLog: 2017-11-18 Janne Blomqvist PR fortran/83036 * io/io.h: Make nextrec a GFC_IO_INT*. --- gcc/fortran/ioparm.def | 2 +- libgfortran/io/io.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index 5fc04bc..59cc7cd 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -62,7 +62,7 @@ IOPARM (inquire, exist, 1 << 7, pint4) 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, nextrec, 1 << 11, pintio) IOPARM (inquire, recl_out, 1 << 12, pintio) IOPARM (inquire, strm_pos_out, 1 << 13, pintio) IOPARM (inquire, file, 1 << 14, char1) diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3330bce..d29b112 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -388,8 +388,7 @@ typedef struct { st_parameter_common common; GFC_INTEGER_4 *exist, *opened, *number, *named; - GFC_INTEGER_4 *nextrec; - GFC_IO_INT *recl_out, *strm_pos_out; + GFC_IO_INT *nextrec, *recl_out, *strm_pos_out; CHARACTER1 (file); CHARACTER2 (access); CHARACTER1 (form); -- 2.7.4 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254916 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/ioparm.def | 2 +- libgfortran/ChangeLog | 5 +++++ libgfortran/io/io.h | 3 +-- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 43349019b6f..2e8bbd82ce1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,10 @@ 2017-11-18 Janne Blomqvist + PR fortran/83036 + * ioparm.def (IOPARM): Make nextrec a pintio. + +2017-11-18 Janne Blomqvist + PR fortran/44292 * ioparm.def (IOPARM): Make recl_in intio, and recl_out pintio. diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index 5fc04bc9019..59cc7cdb432 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -62,7 +62,7 @@ IOPARM (inquire, exist, 1 << 7, pint4) 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, nextrec, 1 << 11, pintio) IOPARM (inquire, recl_out, 1 << 12, pintio) IOPARM (inquire, strm_pos_out, 1 << 13, pintio) IOPARM (inquire, file, 1 << 14, char1) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fa5646ba94f..3af699d1640 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,5 +1,10 @@ 2017-11-18 Janne Blomqvist + PR fortran/83036 + * io/io.h: Make nextrec a GFC_IO_INT*. + +2017-11-18 Janne Blomqvist + PR fortran/44292 * io/io.h: Make recl_in a GC_IO_INT and recl_out a type GFC_IO_INT*. diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3330bcee625..d29b112b9c4 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -388,8 +388,7 @@ typedef struct { st_parameter_common common; GFC_INTEGER_4 *exist, *opened, *number, *named; - GFC_INTEGER_4 *nextrec; - GFC_IO_INT *recl_out, *strm_pos_out; + GFC_IO_INT *nextrec, *recl_out, *strm_pos_out; CHARACTER1 (file); CHARACTER2 (access); CHARACTER1 (form); -- 2.11.4.GIT