diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-01-03 19:49:38 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-01-03 19:49:38 +0000 |
commit | 9370b3c0f9f6d4e3ad3864ae77eac0a353aa41ff (patch) | |
tree | 407a1075cdef9fa8b447f85bf9e754483cb358c1 /gcc | |
parent | 33ae48375f1ceba18d2fe42d10acdf7a6b8acaba (diff) | |
download | gcc-9370b3c0f9f6d4e3ad3864ae77eac0a353aa41ff.zip gcc-9370b3c0f9f6d4e3ad3864ae77eac0a353aa41ff.tar.gz gcc-9370b3c0f9f6d4e3ad3864ae77eac0a353aa41ff.tar.bz2 |
re PR fortran/34565 (internal write to string array fails)
2008-01-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34565
* io/io.h: Adjust protoypes for open_internal(),
next_array_record() and init_loop_spec().
* io/list_read.c (next_char): Use argument "finished"
of next_array_record to check for end on internal file.
* io/unit.c: Calculate the offset for an array
internal file and supply this informatin to open_internal().
* io/unix.c (open_internal): Set the offset for the internal
file on open.
* io/transfer.c (init_loop_spec): Calculate the starting
record in case of negative strides. Return size of 0 for
an empty array.
(next_array_record): Use an extra flag to signal that the
array is finished.
(next_record_r): Use the new flag to next_array_record().
(next_record_w): Likewise.
2008-01-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34565
* gfortran.dg/internal_readwrite_1.f90: New test.
* gfortran.dg/internal_readwrite_2.f90: New test.
From-SVN: r131305
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/internal_readwrite_1.f90 | 15 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/internal_readwrite_2.f90 | 14 |
3 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 962dc97..b2891dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-01-03 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/34565 + * gfortran.dg/internal_readwrite_1.f90: New test. + * gfortran.dg/internal_readwrite_2.f90: New test. + 2008-01-03 Tom Tromey <tromey@redhat.com> PR preprocessor/34602: diff --git a/gcc/testsuite/gfortran.dg/internal_readwrite_1.f90 b/gcc/testsuite/gfortran.dg/internal_readwrite_1.f90 new file mode 100644 index 0000000..405f581 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/internal_readwrite_1.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! PR 34565 - internal writes with negative strides +! didn't work. +program main + implicit none + integer :: i + integer :: lo, up, st + character(len=2) :: c (5) + integer, dimension(5) :: n + c = (/ 'a', 'b', 'c', 'd', 'e' /) + write (unit=c(5:1:-2),fmt="(A)") '5','3', '1' + write (unit=c(2:4:2),fmt="(A)") '2', '4' + read (c(5:1:-1),fmt="(I2)") (n(i), i=5,1,-1) + if (any(n /= (/ (i,i=1,5) /))) call abort +end program main diff --git a/gcc/testsuite/gfortran.dg/internal_readwrite_2.f90 b/gcc/testsuite/gfortran.dg/internal_readwrite_2.f90 new file mode 100644 index 0000000..48b6586 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/internal_readwrite_2.f90 @@ -0,0 +1,14 @@ +! { dg-do run } +! PR 34565 - intenal writes with negative strides. This +! test case tries out a negative stride in a higher +! dimension. +program main + implicit none + integer :: i + integer, parameter :: n1=2, n2=3, n3=5 + character(len=n1*n2*n3*2) :: line + character(len=2), dimension(n1,n2,n3):: c + write (unit=c(:,n2:1:-1,:),fmt="(I2)") (i,i=1,n1*n2*n3) + line = transfer(c,mold=line) + if (line /=" 5 6 3 4 1 21112 910 7 8171815161314232421221920293027282526") call abort +end program main |