[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / dosemantics06.f90
blob8059b4f9651b6774fd5797e2df3fa33b5602808e
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! C1131, C1133 -- check valid and invalid DO loop naming
4 ! C1131 (R1119) If the do-stmt of a do-construct specifies a do-construct-name,
5 ! the corresponding end-do shall be an end-do-stmt specifying the same
6 ! do-construct-name. If the do-stmt of a do-construct does not specify a
7 ! do-construct-name, the corresponding end-do shall not specify a
8 ! do-construct-name.
10 ! C1133 (R1119) If the do-stmt is a label-do-stmt, the corresponding end-do
11 ! shall be identified with the same label.
13 subroutine s1()
14 implicit none
15 ! Valid construct
16 validdo: do while (.true.)
17 print *, "hello"
18 cycle validdo
19 print *, "Weird to get here"
20 end do validdo
22 validdo: do while (.true.)
23 print *, "Hello"
24 end do validdo
26 ! Missing name on initial DO
27 do while (.true.)
28 print *, "Hello"
29 !ERROR: DO construct name unexpected
30 end do formerlabelmissing
32 dolabel: do while (.true.)
33 print *, "Hello"
34 !ERROR: DO construct name mismatch
35 end do differentlabel
37 dowithcycle: do while (.true.)
38 print *, "Hello"
39 !ERROR: CYCLE construct-name is not in scope
40 cycle validdo
41 end do dowithcycle
43 end subroutine s1