Silverfrost Forums

Welcome to our forums

Missing block name not diagnosed

28 Aug 2020 2:23 #26289

Fortran 95 has the following constraint in section 8.1.4.1.1 :

Constraint: If the do-stmt is a label-do-stmt, the corresponding end-do shall be identified with the same label.

The example source code below is in violation of this rule, yet FTN95 does not catch the syntax error.

      subroutine tst(vel,n)
      implicit none
      integer, intent(in) :: n
      real, intent(in) :: vel(n,n)
      integer :: nfound, x, y, i, j
      real u(2)
      
      nfound = 0
      x = 7; y = 5
  dw: do while (nfound < 10)
         call random_number(u)
         u = 5*u + 2.5
         do i = 1,n
            do j = 1,n
               if (vel(j,i) > 25.3 .and. (u(1) > x .or. u(2) < y)) cycle dw
            end do
         end do
      end do ! dw  (this label name is required)
      print *, 'Ten qualified entries found'
      return
      end subroutine

Gfortran gives the message

 Error: Expected block name of 'dw' in END DO statement at (1)
28 Aug 2020 3:36 #26290

mecej4

Thank you for the bug report. I have made a note of this.

31 Aug 2020 7:56 #26298

This has now been fixed for the next release of FTN95. It was failing for DO WHILE and FORALL.

Please login to reply.