OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / do_2.f90
1 ! { dg-do compile }
2 ! Check the fix for PR20839, which concerned non-compliance with one of the
3 ! constraints for block-do-constructs (8.1.4.1.1):
4 ! Constraint: If the do-stmt of a block-do-construct is identified by a 
5 ! do-construct-name, the corresponding end-do shall be an end-do-stmt
6 ! specifying the same do-construct-name. (Tests a & b)
7 ! If the do-stmt of a block-do-construct is not identified by a
8 ! do-construct-name, the corresponding end-do shall not specify a
9 ! do-construct-name. (Tests c & d)
10 ! Constraint: If the do-stmt is a nonlabel-do-stmt, the corresponding end-do
11 ! shall be an end-do-stmt.
12 ! Constraint: If the do-stmt is a label-do-stmt, the corresponding end-do shall
13 ! be identified with the same label.
14 !
15 ! Test a - this was the PR
16   doi: DO 111 i=1,3 ! { dg-error "requires matching ENDDO name" }
17 111 continue 
18 ! Test b
19   doii: DO 112 ij=1,3
20 112 enddo doij      ! { dg-error "Expected label" }
21 ! Test c
22   DO 113 ik=1,3
23 113 enddo doik      ! { dg-error "Syntax error" }
24 ! Test d
25   DO il=1,3
26   enddo doil        ! { dg-error "Syntax error" }
27 ! Test e
28   doj: DO 114 j=1,3
29   enddo doj         ! { dg-error "doesn't match DO label" }
30
31 ! Correct block do constructs
32 dok: DO 115 k=1,3
33     dokk: do kk=1,3
34         dokkk: DO
35                    do kkkk=1,3
36                        do
37                        enddo
38                    enddo
39                enddo dokkk
40           enddo dokk
41 115  enddo dok 
42 ! Correct non-block do constructs
43   do 117 l=1,3
44       do ll=1,3
45           do 116 lll=1,3
46 116       continue
47       enddo
48 117 enddo
49 ! These prevent an EOF error, arising from the previous errors.
50 end do
51 113 end do
52 112 end do doii
53 END
54