diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-01-26 15:22:59 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-01-26 15:22:59 +0000 |
commit | 6cac36304e7153206248af3511287d44bacd3ae2 (patch) | |
tree | fc4b24390f3439ee4e597fbe0adfce8a6dc647d5 | |
parent | 1230d7f8de706221a1b6f3d81a20efc2052b7e0a (diff) | |
download | gcc-6cac36304e7153206248af3511287d44bacd3ae2.zip gcc-6cac36304e7153206248af3511287d44bacd3ae2.tar.gz gcc-6cac36304e7153206248af3511287d44bacd3ae2.tar.bz2 |
re PR libfortran/34887 (reverse tabbing before slash descriptor (regression vs. g77))
2008-01-26 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfofortran/34887
* io/transfer.c (next_record_w): Always move to the farthest
position when completing the record (also when we are
processing a slash edit descriptor).
2008-01-26 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfofortran/34887
* gfortran.dg/x_slash_2.f: New test.
From-SVN: r131864
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/x_slash_2.f | 11 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 23 |
4 files changed, 33 insertions, 13 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6535805..583a158 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-26 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfofortran/34887 + * gfortran.dg/x_slash_2.f: New test. + 2008-01-26 Richard Guenther <rguenther@suse.de> PR c++/34235 diff --git a/gcc/testsuite/gfortran.dg/x_slash_2.f b/gcc/testsuite/gfortran.dg/x_slash_2.f new file mode 100644 index 0000000..6023b64 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/x_slash_2.f @@ -0,0 +1,11 @@ +! { dg-do run } +! PR 34887 - reverse tabs followed by a slash used to confuse I/O. + program main + character(len=2) :: b, a + open(10,form="formatted") + write (10,'(3X, A, T1, A,/)') 'aa', 'bb' + rewind(10) + read (10,'(A2,1X,A2)') b,a + if (a /= 'aa' .or. b /= 'bb') call abort + close(10,status="delete") + end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1c9148c..a83ee24 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2008-01-26 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfofortran/34887 + * io/transfer.c (next_record_w): Always move to the farthest + position when completing the record (also when we are + processing a slash edit descriptor). + 2008-01-25 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/34876 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index e94eb74..52c6314 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -2573,21 +2573,18 @@ next_record_w (st_parameter_dt *dtp, int done) } else { - /* If this is the last call to next_record move to the farthest - position reached in preparation for completing the record. - (for file unit) */ - if (done) - { - m = dtp->u.p.current_unit->recl - - dtp->u.p.current_unit->bytes_left; - if (max_pos > m) - { - length = (int) (max_pos - m); - p = salloc_w (dtp->u.p.current_unit->s, &length); - } - } size_t len; const char crlf[] = "\r\n"; + + /* Move to the farthest position reached in preparation for + completing the record. (for file unit) */ + m = dtp->u.p.current_unit->recl - + dtp->u.p.current_unit->bytes_left; + if (max_pos > m) + { + length = (int) (max_pos - m); + p = salloc_w (dtp->u.p.current_unit->s, &length); + } #ifdef HAVE_CRLF len = 2; #else |