summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-13 03:44:34 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-13 03:44:34 +0000
commit594bffbc24b8c00fb4ab8189b67307c61386d712 (patch)
treeded4b844641cda24ff87fbd1a671cafd0943b495
parent2810ae9b4b8bc4ab42a3cee055cf9319195a1fec (diff)
downloadgcc-594bffbc24b8c00fb4ab8189b67307c61386d712.tar.gz
2009-09-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/41328 * gfortran.dg/cr_lf.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151666 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/cr_lf.f9036
2 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2a0705a45b3..cc1b26b3b2e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/41328
+ * gfortran.dg/cr_lf.f90: New test.
+
2009-09-11 Michael Matz <matz@suse.de>
PR middle-end/41275
diff --git a/gcc/testsuite/gfortran.dg/cr_lf.f90 b/gcc/testsuite/gfortran.dg/cr_lf.f90
new file mode 100644
index 00000000000..855e7036095
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/cr_lf.f90
@@ -0,0 +1,36 @@
+! { dg-do run }
+! { dg-options "-fbackslash" }
+! PR41328 and PR41168 Improper read of CR-LF sequences.
+! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program main
+ implicit none
+ integer :: iostat, n_chars_read
+ character(len=1) :: buffer(64) = ""
+ open( unit=10, form="formatted", access="stream", status="scratch")
+ write(10, fmt="(a)", advance="no") "a\rb\rc\r"
+ rewind(10)
+
+ read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
+ size=n_chars_read ) buffer
+ if (n_chars_read.ne.1) call abort
+ if (any(buffer(1:n_chars_read).ne."a")) call abort
+ if (.not.is_iostat_eor(iostat)) call abort
+
+ read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
+ size=n_chars_read ) buffer
+ if (n_chars_read.ne.1) call abort
+ if (any(buffer(1:n_chars_read).ne."b")) call abort
+ if (.not.is_iostat_eor(iostat)) call abort
+
+ read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
+ size=n_chars_read ) buffer
+ if (n_chars_read.ne.1) call abort
+ if (any(buffer(1:n_chars_read).ne."c")) call abort
+ if (.not.is_iostat_eor(iostat)) call abort
+
+ read( unit=10, fmt='(64A)', advance='NO', iostat=iostat, &
+ size=n_chars_read ) buffer
+ if (n_chars_read.ne.0) call abort
+ if (any(buffer(1:n_chars_read).ne."a")) call abort
+ if (.not.is_iostat_end(iostat)) call abort
+end program main