diff options
author | Bud Davis <bdavis@gcc.gnu.org> | 2004-06-09 01:03:02 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2004-06-09 01:03:02 +0000 |
commit | 898c05b8bd9d73fdb3dd1e9e4e4044b0ac74a789 (patch) | |
tree | 2750ee5b1877241a5b772185087f286b7f1a8f59 | |
parent | 31b6f11ab0530374184676979781ba81b06ae38f (diff) | |
download | gcc-898c05b8bd9d73fdb3dd1e9e4e4044b0ac74a789.zip gcc-898c05b8bd9d73fdb3dd1e9e4e4044b0ac74a789.tar.gz gcc-898c05b8bd9d73fdb3dd1e9e4e4044b0ac74a789.tar.bz2 |
re PR libfortran/14897 ('T' edit descriptor output incorrect)
2004-06-09 Bud Davis <bdavis9659@comcast.net>
PR gfortran/14897
* gfortran.fortran-torture/execute/t_edit.f90
* io/transfer.c (formatted_transfer): position is unique
for T and TL edit descriptors.
(data_transfer_init): set record length to size of internal
file.
From-SVN: r82808
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/execute/t_edit.f90 | 11 | ||||
-rw-r--r-- | libgfortran/ChangeLog | 8 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 26 |
4 files changed, 41 insertions, 9 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00f5518..d726cf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,9 @@ 2004-06-09 Bud Davis <bdavis9659@comcast.net> + + PR gfortran/14897 + * gfortran.fortran-torture/execute/t_edit.f90 + +2004-06-09 Bud Davis <bdavis9659@comcast.net> PR gfortran/15755 * gfortran.fortran-torture/execute/backspace.c : New test. diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/t_edit.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/t_edit.f90 new file mode 100644 index 0000000..9746f31 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/t_edit.f90 @@ -0,0 +1,11 @@ +!pr 14897 T edit descriptor broken + implicit none + character*80 line + WRITE(line,'(T5,A,T10,A,T15,A)')'AA','BB','CC' + if (line.ne.' AA BB CC ') call abort + WRITE(line,'(5HAAAAA,TL4,4HABCD)') + if (line.ne.'AABCD') call abort + END + + + diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index ab7d376..e9f17ee 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,11 @@ +2004-06-09 Bud Davis <bdavis9659@comcaste.net> + + PR gfortran/14897 + * io/transfer.c (formatted_transfer): position is unique + for T and TL edit descriptors. + (data_transfer_init): set record length to size of internal + file. + 2004-06-09 Bud Davis <bdavis9659@comcast.net> PR gfortran/15755 diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index d5ef5c6..04b7c5a 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -608,14 +608,18 @@ formatted_transfer (bt type, void *p, int len) break; - case FMT_T: - pos = f->u.n ; - pos= current_unit->recl - current_unit->bytes_left - pos; - /* fall through */ - case FMT_TL: - consume_data_flag = 0 ; - pos = f->u.n ; + case FMT_T: + if (f->format==FMT_TL) + { + pos = f->u.n ; + pos= current_unit->recl - current_unit->bytes_left - pos; + } + else // FMT==T + { + consume_data_flag = 0 ; + pos = f->u.n - 1; + } if (pos < 0 || pos >= current_unit->recl ) { @@ -898,8 +902,12 @@ data_transfer_init (int read_flag) if (current_unit == NULL) return; - if (is_internal_unit() && g.mode==WRITING) - empty_internal_buffer (current_unit->s); + if (is_internal_unit()) + { + current_unit->recl = file_length(current_unit->s); + if (g.mode==WRITING) + empty_internal_buffer (current_unit->s); + } /* Check the action */ |