summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/forall_12.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/forall_12.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/forall_12.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/forall_12.f9040
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/forall_12.f90 b/gcc/testsuite/gfortran.dg/forall_12.f90
new file mode 100644
index 000000000..207977c51
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/forall_12.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+! Tests the fix for PR31217 and PR33811 , in which dependencies were not
+! correctly handled for the assignments below and, when this was fixed,
+! the last two ICEd on trying to create the temorary.
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+! Dominique d'Humieres <dominiq@lps.ens.fr>
+! and Paul Thomas <pault@gcc.gnu.org>
+!
+ character(len=1) :: a = "1"
+ character(len=1) :: b(4) = (/"1","2","3","4"/), c(4)
+ c = b
+ forall(i=1:1) a(i:i) = a(i:i) ! This was the original PR31217
+ forall(i=1:1) b(i:i) = b(i:i) ! The rest were found to be broken
+ forall(i=1:1) b(:)(i:i) = b(:)(i:i)
+ forall(i=1:1) b(1:3)(i:i) = b(2:4)(i:i)
+ if (any (b .ne. (/"2","3","4","4"/))) call abort ()
+ b = c
+ forall(i=1:1) b(2:4)(i:i) = b(1:3)(i:i)
+ if (any (b .ne. (/"1","1","2","3"/))) call abort ()
+ b = c
+ do i = 1, 1
+ b(2:4)(i:i) = b(1:3)(i:i) ! This was PR33811 and Paul's bit
+ end do
+ if (any (b .ne. (/"1","1","2","3"/))) call abort ()
+ call foo
+contains
+ subroutine foo
+ character(LEN=12) :: a(2) = "123456789012"
+ character(LEN=12) :: b = "123456789012"
+! These are Dominique's
+ forall (i = 3:10) a(:)(i:i+2) = a(:)(i-2:i)
+ IF (a(1) .ne. "121234567890") CALL abort ()
+ forall (i = 3:10) a(2)(i:i+2) = a(1)(i-2:i)
+ IF (a(2) .ne. "121212345678") call abort ()
+ forall (i = 3:10) b(i:i+2) = b(i-2:i)
+ IF (b .ne. "121234567890") CALL abort ()
+ end subroutine
+end
+