[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / assign06.f90
blob406bf2084f9da3dff854ed3872edf8e4a1dea1ff
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Test ASSIGN statement, assigned GOTO, and assigned format labels
4 ! (see subclause 8.2.4 in Fortran 90 (*not* 2018!)
6 program main
7 call test(0)
8 contains
9 subroutine test(n)
10 integer, intent(in) :: n
11 integer :: lab
12 integer(kind=1) :: badlab1
13 real :: badlab2
14 integer :: badlab3(1)
15 assign 1 to lab ! ok
16 assign 1 to implicitlab1 ! ok
17 !ERROR: 'badlab1' must be a default integer scalar variable
18 assign 1 to badlab1
19 !ERROR: 'badlab2' must be a default integer scalar variable
20 assign 1 to badlab2
21 !ERROR: 'badlab3' must be a default integer scalar variable
22 assign 1 to badlab3
23 !ERROR: 'test' must be a default integer scalar variable
24 assign 1 to test
25 if (n==1) goto lab ! ok
26 if (n==1) goto implicitlab2 ! ok
27 !ERROR: 'badlab1' must be a default integer scalar variable
28 if (n==1) goto badlab1
29 !ERROR: 'badlab2' must be a default integer scalar variable
30 if (n==1) goto badlab2
31 !ERROR: 'badlab3' must be a default integer scalar variable
32 if (n==1) goto badlab3
33 if (n==1) goto lab(1) ! ok
34 if (n==1) goto lab,(1) ! ok
35 if (n==1) goto lab(1,1) ! ok
36 assign 3 to lab ! ok
37 write(*,fmt=lab) ! ok
38 write(*,fmt=implicitlab3) ! ok
39 !ERROR: Format expression must be default character or integer
40 write(*,fmt=badlab1)
41 !ERROR: Format expression must be default character or integer
42 write(*,fmt=badlab2)
43 !ERROR: Format expression must be default character or integer
44 write(*,fmt=badlab2)
45 1 continue
46 3 format('yes')
47 end subroutine test
48 end program