FIX: Incorrect Range Checking with Arrays Dimensioned (1)

ID: Q106560


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.1, 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS, version 1.0
  • Microsoft Fortran Powerstation 32 for Windows NT, version 1.0


SYMPTOMS

Extended error handling (enabled by $DEBUG or /4Yb) does not catch subscript out-of-range errors for positive subscripts with arrays declared to have dimension (1).


STATUS

Microsoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.1, 5.0, and 5.1, and FORTRAN PowerStation version 1.0 for MS-DOS and Windows NT. This problem has been resolved with FORTRAN PowerStation maintenance release version 1.0a for MS-DOS.

FORTRAN PowerStation version 1.0 can be differentiated from the maintenance release version 1.0a by invoking the linker. Typing link32 | more from \F32\BIN directory will show version 2.8 for FORTRAN PowerStation version 1.0, and it will show version 1.0f for the maintenance release version 1.0a.


MORE INFORMATION

The lower range is correctly checked for dimension (1). Attempts to access array element 0 (zero) or less will generate a subscript range check error. Subscript range checking works correctly if the dimension is (1:1) or (N) where N is at least 2.

Sample Code


C Compile options needed: /4Yb

      integer a(1), b(1:1), c(2), i,n
      real    d(1)
      read *, i, n
      if     ( i .eq. 1 ) then
         a(n) = 3
         print *, a(n)
      elseif ( i .eq. 2 ) then
         b(n) = 3
         print *, b(n)
      elseif ( i .eq. 3 ) then
         c(n) = 3
         print *, c(n)
      elseif ( i .eq. 4 ) then
         d(n) = 3
         print *, d(n)
      end if
      end

C Input:    Result:
C  1 2         3
C  1 0         run-time error F6096: test.for(6)
C  2 2         run-time error F6096: test.for(9)
C  3 3         run-time error F6096: test.for(12)
C  4 2         3.000000 

Additional query words: 1.00 4.00 4.00a 4.10 5.00 5.10 buglist1.00 buglist4.00 buglist4.10 buglist5.00 buglist5.10

Keywords :
Version : :1.0,4.0,4.1,5.0,5.1
Platform :
Issue type :


Last Reviewed: November 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.