summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/arrayio_1.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/arrayio_1.f90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/arrayio_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/arrayio_1.f9032
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/arrayio_1.f90 b/gcc/testsuite/gfortran.dg/arrayio_1.f90
new file mode 100644
index 000000000..7b40d6573
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/arrayio_1.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! PR 21875 : Test formatted input/output to/from character arrays.
+! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
+ program arrayio_1
+ implicit none
+ integer :: i(6),j,k
+ character(12) :: r(12,2) = '0123456789AB'
+
+! Write to and read from a whole character array
+
+ i = (/(j,j=1,6)/)
+ write(r,'(3(2x,i4/)/3(3x,i6/))') i
+ i = 0
+ read(r,'(3(2x,i4/)/3(3x,i6/))') i
+ if (any(i.ne.(/(j,j=1,6)/))) call abort()
+ do j=1,12
+ do k=1,2
+ if ((j.gt.8.and.k.eq.1).or.(k.eq.2)) then
+ if (r(j,k).ne.'0123456789AB') call abort()
+ end if
+ end do
+ end do
+
+ ! Write to a portion of a character array
+ r = '0123456789AB'
+ write(r(3:9,1),'(6(i12/))') i
+ if (r(2,1).ne.'0123456789AB') call abort()
+ do j=3,8
+ if (iachar(trim(adjustl(r(j,1))))-46.ne.j) call abort()
+ end do
+ if (r(9,1).ne.' ') call abort()
+ end program arrayio_1