summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/block_name_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/block_name_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/block_name_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/block_name_1.f9078
1 files changed, 78 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/block_name_1.f90 b/gcc/testsuite/gfortran.dg/block_name_1.f90
new file mode 100644
index 000000000..600885c3a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/block_name_1.f90
@@ -0,0 +1,78 @@
+! { dg-do compile }
+! Verify that the compiler accepts the various legal combinations of
+! using construct names.
+!
+! The correct behavior of EXIT and CYCLE is already established in
+! the various DO related testcases, they're included here for
+! completeness.
+ dimension a(5)
+ i = 0
+ ! construct name is optional on else clauses
+ ia: if (i > 0) then
+ i = 1
+ else
+ i = 2
+ end if ia
+ ib: if (i < 0) then
+ i = 3
+ else ib
+ i = 4
+ end if ib
+ ic: if (i < 0) then
+ i = 5
+ else if (i == 0) then ic
+ i = 6
+ else if (i == 1) then
+ i =7
+ else if (i == 2) then ic
+ i = 8
+ end if ic
+
+ fa: forall (i=1:5, a(i) > 0)
+ a(i) = 9
+ end forall fa
+
+ wa: where (a > 0)
+ a = -a
+ elsewhere
+ wb: where (a == 0)
+ a = a + 1.
+ elsewhere wb
+ a = 2*a
+ end where wb
+ end where wa
+
+ j = 1
+ sa: select case (i)
+ case (1)
+ i = 2
+ case (2) sa
+ i = 3
+ case default sa
+ sb: select case (j)
+ case (1) sb
+ i = j
+ case default
+ j = i
+ end select sb
+ end select sa
+
+ da: do i=1,10
+ cycle da
+ cycle
+ exit da
+ exit
+ db: do
+ cycle da
+ cycle db
+ cycle
+ exit da
+ exit db
+ exit
+ j = i+1
+ end do db
+ dc: do while (j>0)
+ j = j-1
+ end do dc
+ end do da
+end