summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/array_assignment_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/array_assignment_1.F90
downloadcbb-gcc-4.6.4-upstream.tar.bz2
cbb-gcc-4.6.4-upstream.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/array_assignment_1.F90')
-rw-r--r--gcc/testsuite/gfortran.dg/array_assignment_1.F9039
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/array_assignment_1.F90 b/gcc/testsuite/gfortran.dg/array_assignment_1.F90
new file mode 100644
index 000000000..328107011
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_assignment_1.F90
@@ -0,0 +1,39 @@
+! { dg-do run }
+! { dg-options "-ffree-line-length-none" }
+! Test that different array assignments work even when interleaving,
+! reversing etc. Make sure the results from assignment with constants
+! as array triples and runtime array triples (where we always create
+! a temporary) match.
+#define TST(b,c,d,e,f,g,r) a=init; a(b:c:d) = a(e:f:g); \
+ write(unit=line ,fmt="(9I1)") a;\
+ if (line /= r) call abort ; \
+ call mytst(b,c,d,e,f,g,r);
+
+program main
+ implicit none
+ integer :: i
+ integer, parameter :: n=9
+ integer, dimension(n) :: a
+ character(len=n) :: line
+ integer, dimension(n), parameter :: init = (/(i,i=1,n)/)
+ TST(2,n,2,1,n-1,2,'113355779')
+ TST(3,9,3,2,6,2,'122454786');
+ TST(1,8,2,3,9,2,'325476989');
+ TST(1,6,1,4,9,1,'456789789');
+ TST(9,5,-1,1,5,1,'123454321');
+ TST(9,5,-2,1,5,2,'123456381');
+ TST(5,9,2,5,1,-2,'123456381');
+ TST(1,6,1,2,7,1,'234567789');
+ TST(2,7,1,1,6,1,'112345689');
+end program main
+
+subroutine mytst(b,c,d,e,f,g,r)
+ integer,intent(in) :: b,c,d,e,f,g
+ character(len=9), intent(in) :: r
+ character(len=9) :: line
+ integer, dimension(9) :: a
+ a = (/(i,i=1,9)/)
+ a(b:c:d) = a(e:f:g)
+ write (unit=line,fmt='(9I1)') a
+ if (line /= r) call abort
+end subroutine mytst