This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make NEXTREC specifier for INQUIRE work for large record numbers
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Cc: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- Date: Sat, 18 Nov 2017 12:34:10 +0200
- Subject: [PATCH] Make NEXTREC specifier for INQUIRE work for large record numbers
- Authentication-results: sourceware.org; auth=none
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) + 2_8) then
call abort()
end if
close(10, status="delete")
end program nextrec
Regtested on x86_64-pc-linux-gnu, Ok for trunk?
gcc/fortran/ChangeLog:
2017-11-18 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83036
* ioparm.def (IOPARM): Make nextrec a pintio.
libgfortran/ChangeLog:
2017-11-18 Janne Blomqvist <jb@gcc.gnu.org>
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, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def
index ca5631b..920934a 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, pint4)
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 df49157..483ee93 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -388,7 +388,8 @@ typedef struct
{
st_parameter_common common;
GFC_INTEGER_4 *exist, *opened, *number, *named;
- GFC_INTEGER_4 *nextrec, *recl_out;
+ GFC_IO_INT *nextrec;
+ GFC_INTEGER_4 *recl_out;
GFC_IO_INT *strm_pos_out;
CHARACTER1 (file);
CHARACTER2 (access);
--
2.7.4