Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / dosemantics06.f90
blob1e7fd89c2ebae079a4ecfe83718d17b12b063e45
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C1131, C1133 -- check valid and invalid DO loop naming
3 ! C1131 (R1119) If the do-stmt of a do-construct specifies a do-construct-name,
4 ! the corresponding end-do shall be an end-do-stmt specifying the same
5 ! do-construct-name. If the do-stmt of a do-construct does not specify a
6 ! do-construct-name, the corresponding end-do shall not specify a
7 ! do-construct-name.
9 ! C1133 (R1119) If the do-stmt is a label-do-stmt, the corresponding end-do
10 ! shall be identified with the same label.
12 subroutine s1()
13 implicit none
14 ! Valid construct
15 validdo: do while (.true.)
16 print *, "hello"
17 cycle validdo
18 print *, "Weird to get here"
19 end do validdo
21 validdo: do while (.true.)
22 print *, "Hello"
23 end do validdo
25 ! Missing name on initial DO
26 do while (.true.)
27 print *, "Hello"
28 !ERROR: DO construct name unexpected
29 end do formerlabelmissing
31 dolabel: do while (.true.)
32 print *, "Hello"
33 !ERROR: DO construct name mismatch
34 end do differentlabel
36 dowithcycle: do while (.true.)
37 print *, "Hello"
38 !ERROR: CYCLE construct-name is not in scope
39 cycle validdo
40 end do dowithcycle
42 end subroutine s1