summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/eof_1.f90
diff options
context:
space:
mode:
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-31 15:53:31 +0000
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-31 15:53:31 +0000
commit11de4bf919a5375316d3d5f0148205855f22a946 (patch)
treeeeec759a476bd4d9d5f8e220e891469fe79a14bb /gcc/testsuite/gfortran.dg/eof_1.f90
parent50a9015ddd0a2afc02a2cbf31b14d152547cf226 (diff)
downloadgcc-11de4bf919a5375316d3d5f0148205855f22a946.tar.gz
* io/transfer.c (read_sf): Rename uinty to readlen. Detect EOF.
(finalize_transfer): Move setjmp after namlist IO. * io/unix.c (mem_alloc_r_at): Calculate remaining length correctly. testsuite/ * gfortran.dg/eof_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86831 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/eof_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/eof_1.f9018
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/eof_1.f90 b/gcc/testsuite/gfortran.dg/eof_1.f90
new file mode 100644
index 00000000000..05726bd1413
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/eof_1.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! Program to test for proper EOF errors when reading past the end of a file.
+! We used to get this wrong when a formatted read followed a list formatted
+! read.
+program eof_1
+ character(len=5) :: s
+
+ open (unit=11, status="SCRATCH")
+ write (11, '(a)') "Hello"
+ rewind(11)
+ read(11, *) s
+ if (s .ne. "Hello") call abort
+ read(11, '(a5)', end=10) s
+ call abort
+10 continue
+ close (11)
+end
+