Silverfrost Forums

Welcome to our forums

Failure to detect undefined variable in a common block

10 Jan 2023 11:34 #29803

In the following program, one of the variables in a COMMON block is used before it has been defined.

!
      program buggy
      implicit none
      external blkd
      integer i,j,k,l,m,n
      common /bb/i,j,k,l,m,n
      integer ksum
      ksum = i+j+k+l+m+n
      print *,k,ksum
      end program
!
      block data blkd
      implicit none
      integer i,j,k,l,m,n
      common /bb/i,j,k,l,m,n
      data i,j,l,m,n/1,2,4,5,6/  !k is not defined
      end
!

Compiling with /undef in a 32-bit compilation yields an EXE that when run displays the error.

With /64 /undef, however, the error goes undetected.

10 Jan 2023 12:04 #29806

mecej4

Thank you for the bug report which I have logged for investigation.

20 Nov 2023 10:41 #30762

mecej4

It turns out that /UNDEF has not been implemented for BLOCK DATA and 64 bit programming. This was presumably because of the complexities of handling this for 64 bits and the understanding that BLOCK DATA is rarely used.

I have been informed that there are no immediate plans to implement this feature and I will change the documentation to reflect this.

21 Nov 2023 1:07 #30764

Thanks, Paul. I understand that it can be difficult to support debugging code with old features, such as BLOCKDATA, for which modern alternatives are available.

Please login to reply.