summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/coarray_3.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/coarray_3.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/coarray_3.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_3.f90100
1 files changed, 100 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/coarray_3.f90 b/gcc/testsuite/gfortran.dg/coarray_3.f90
new file mode 100644
index 000000000..63c3bd335
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_3.f90
@@ -0,0 +1,100 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! Coarray support
+! PR fortran/18918
+
+implicit none
+integer :: n, m(1), k
+character(len=30) :: str(2)
+
+critical fkl ! { dg-error "Syntax error in CRITICAL" }
+end critical fkl ! { dg-error "Expecting END PROGRAM" }
+
+sync all (stat=1) ! { dg-error "Syntax error in SYNC ALL" }
+sync all ( stat = n,stat=k) ! { dg-error "Redundant STAT" }
+sync memory (errmsg=str)
+sync memory (errmsg=n) ! { dg-error "must be a scalar CHARACTER variable" }
+sync images (*, stat=1.0) ! { dg-error "Syntax error in SYNC IMAGES" }
+sync images (-1) ! { dg-error "must between 1 and num_images" }
+sync images (1)
+sync images ( [ 1 ])
+sync images ( m(1:0) )
+sync images ( reshape([1],[1,1])) ! { dg-error "must be a scalar or rank-1" }
+end
+
+subroutine foo
+critical
+ stop 'error' ! { dg-error "Image control statement STOP" }
+ sync all ! { dg-error "Image control statement SYNC" }
+ return 1 ! { dg-error "Image control statement RETURN" }
+ critical ! { dg-error "Nested CRITICAL block" }
+ end critical
+end critical ! { dg-error "Expecting END SUBROUTINE" }
+end
+
+subroutine bar()
+do
+ critical
+ cycle ! { dg-error "leaves CRITICAL construct" }
+ end critical
+end do
+
+outer: do
+ critical
+ do
+ exit
+ exit outer ! { dg-error "leaves CRITICAL construct" }
+ end do
+ end critical
+end do outer
+end subroutine bar
+
+
+subroutine sub()
+333 continue ! { dg-error "leaves CRITICAL construct" }
+do
+ critical
+ if (.false.) then
+ goto 333 ! { dg-error "leaves CRITICAL construct" }
+ goto 777
+777 end if
+ end critical
+end do
+
+if (.true.) then
+outer: do
+ critical
+ do
+ goto 444
+ goto 555 ! { dg-error "leaves CRITICAL construct" }
+ end do
+444 continue
+ end critical
+ end do outer
+555 end if ! { dg-error "leaves CRITICAL construct" }
+end subroutine sub
+
+pure subroutine pureSub()
+ critical ! { dg-error "Image control statement CRITICAL" }
+ end critical ! { dg-error "Expecting END SUBROUTINE statement" }
+ sync all ! { dg-error "Image control statement SYNC" }
+ error stop ! { dg-error "not allowed in PURE procedure" }
+end subroutine pureSub
+
+
+SUBROUTINE TEST
+ goto 10 ! { dg-warning "is not in the same block" }
+ CRITICAL
+ goto 5 ! OK
+5 continue ! { dg-warning "is not in the same block" }
+ goto 10 ! OK
+ goto 20 ! { dg-error "leaves CRITICAL construct" }
+ goto 30 ! { dg-error "leaves CRITICAL construct" }
+10 END CRITICAL ! { dg-warning "is not in the same block" }
+ goto 5 ! { dg-warning "is not in the same block" }
+20 continue ! { dg-error "leaves CRITICAL construct" }
+ BLOCK
+30 continue ! { dg-error "leaves CRITICAL construct" }
+ END BLOCK
+end SUBROUTINE TEST