PR c++/27177
[official-gcc.git] / gcc / testsuite / gfortran.dg / duplicate_labels.f90
blob7523d0c41b51915a5aa0de3a143cfde366c9df66
1 ! { dg-do compile }
2 ! PR 21257
3 program dups
5 integer i,j,k
7 abc: do i = 1, 3
8 abc: do j = 1, 3 ! { dg-error "Duplicate construct label" }
9 k = i + j
10 end do abc
11 end do abc ! { dg-error "Expecting END PROGRAM" }
13 xyz: do i = 1, 2
14 k = i + 2
15 end do xyz
16 xyz: do j = 1, 5 ! { dg-error "Duplicate construct label" }
17 k = j + 2
18 end do loop ! { dg-error "Expecting END PROGRAM" }
20 her: if (i == 1) then
21 her: if (j == 1) then ! { dg-error "Duplicate construct label" }
22 k = i + j
23 end if her
24 end if her ! { dg-error "Expecting END PROGRAM" }
26 his: if (i == 1) then
27 i = j
28 end if his
29 his: if (j === 1) then ! { dg-error "Duplicate construct label" }
30 print *, j
31 end if his ! { dg-error "Expecting END PROGRAM" }
33 sgk: select case (i)
34 case (1)
35 sgk: select case (j) ! { dg-error "Duplicate construct label" }
36 case (10)
37 i = i + j
38 case (20)
39 j = j + i
40 end select sgk
41 case (2) ! { dg-error "Unexpected CASE statement" }
42 i = i + 1
43 j = j + 1
44 end select sgk ! { dg-error "Expecting END PROGRAM" }
46 apl: select case (i)
47 case (1)
48 k = 2
49 case (2)
50 j = 1
51 end select apl
52 apl: select case (i) ! { dg-error "Duplicate construct label" }
53 case (1) ! { dg-error "Unexpected CASE statement" }
54 j = 2
55 case (2) ! { dg-error "Unexpected CASE statement" }
56 k = 1
57 end select apl ! { dg-error "Expecting END PROGRAM" }
59 end program dups