summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/do_2.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/do_2.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/do_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/do_2.f9054
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/do_2.f90 b/gcc/testsuite/gfortran.dg/do_2.f90
new file mode 100644
index 000000000..207b06a54
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/do_2.f90
@@ -0,0 +1,54 @@
+! { dg-do compile }
+! Check the fix for PR20839, which concerned non-compliance with one of the
+! constraints for block-do-constructs (8.1.4.1.1):
+! Constraint: If the do-stmt of a block-do-construct is identified by a
+! do-construct-name, the corresponding end-do shall be an end-do-stmt
+! specifying the same do-construct-name. (Tests a & b)
+! If the do-stmt of a block-do-construct is not identified by a
+! do-construct-name, the corresponding end-do shall not specify a
+! do-construct-name. (Tests c & d)
+! Constraint: If the do-stmt is a nonlabel-do-stmt, the corresponding end-do
+! shall be an end-do-stmt.
+! Constraint: If the do-stmt is a label-do-stmt, the corresponding end-do shall
+! be identified with the same label.
+!
+! Test a - this was the PR
+ doi: DO 111 i=1,3 ! { dg-error "requires matching ENDDO name" }
+111 continue
+! Test b
+ doii: DO 112 ij=1,3
+112 enddo doij ! { dg-error "Expected label" }
+! Test c
+ DO 113 ik=1,3
+113 enddo doik ! { dg-error "Syntax error" }
+! Test d
+ DO il=1,3
+ enddo doil ! { dg-error "Syntax error" }
+! Test e
+ doj: DO 114 j=1,3
+ enddo doj ! { dg-error "doesn't match DO label" }
+
+! Correct block do constructs
+dok: DO 115 k=1,3
+ dokk: do kk=1,3
+ dokkk: DO
+ do kkkk=1,3
+ do
+ enddo
+ enddo
+ enddo dokkk
+ enddo dokk
+115 enddo dok
+! Correct non-block do constructs
+ do 117 l=1,3
+ do ll=1,3
+ do 116 lll=1,3
+116 continue
+ enddo
+117 enddo
+! These prevent an EOF error, arising from the previous errors.
+end do
+113 end do
+112 end do doii
+END
+