• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! RUN: %S/test_errors.sh %s %t %f18
2! Test ASSIGN statement, assigned GOTO, and assigned format labels
3! (see subclause 8.2.4 in Fortran 90 (*not* 2018!)
4
5program main
6  call test(0)
72 format('no')
8 contains
9  subroutine test(n)
10    !ERROR: Label '4' is not a branch target or FORMAT
114   integer, intent(in) :: n
12    integer :: lab
13    assign 1 to lab ! ok
14    assign 1 to implicitlab1 ! ok
15    !ERROR: Label '666' was not found
16    assign 666 to lab
17    !ERROR: Label '2' was not found
18    assign 2 to lab
19    assign 4 to lab
20    if (n==1) goto lab ! ok
21    if (n==1) goto implicitlab2 ! ok
22    if (n==1) goto lab(1) ! ok
23    if (n==1) goto lab,(1) ! ok
24    if (n==1) goto lab(1,1) ! ok
25    !ERROR: Label '666' was not found
26    if (n==1) goto lab(1,666)
27    !ERROR: Label '2' was not found
28    if (n==1) goto lab(1,2)
29    assign 3 to lab
30    write(*,fmt=lab) ! ok
31    write(*,fmt=implicitlab3) ! ok
321   continue
333   format('yes')
34  end subroutine test
35end program
36