Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / block_name_1.f90
blob600885c3ad54888c75343e62aaccfc31b3fdb8cc
1 ! { dg-do compile }
2 ! Verify that the compiler accepts the various legal combinations of
3 ! using construct names.
5 ! The correct behavior of EXIT and CYCLE is already established in
6 ! the various DO related testcases, they're included here for
7 ! completeness.
8 dimension a(5)
9 i = 0
10 ! construct name is optional on else clauses
11 ia: if (i > 0) then
12 i = 1
13 else
14 i = 2
15 end if ia
16 ib: if (i < 0) then
17 i = 3
18 else ib
19 i = 4
20 end if ib
21 ic: if (i < 0) then
22 i = 5
23 else if (i == 0) then ic
24 i = 6
25 else if (i == 1) then
26 i =7
27 else if (i == 2) then ic
28 i = 8
29 end if ic
31 fa: forall (i=1:5, a(i) > 0)
32 a(i) = 9
33 end forall fa
35 wa: where (a > 0)
36 a = -a
37 elsewhere
38 wb: where (a == 0)
39 a = a + 1.
40 elsewhere wb
41 a = 2*a
42 end where wb
43 end where wa
45 j = 1
46 sa: select case (i)
47 case (1)
48 i = 2
49 case (2) sa
50 i = 3
51 case default sa
52 sb: select case (j)
53 case (1) sb
54 i = j
55 case default
56 j = i
57 end select sb
58 end select sa
60 da: do i=1,10
61 cycle da
62 cycle
63 exit da
64 exit
65 db: do
66 cycle da
67 cycle db
68 cycle
69 exit da
70 exit db
71 exit
72 j = i+1
73 end do db
74 dc: do while (j>0)
75 j = j-1
76 end do dc
77 end do da
78 end