Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/106560

From BetaArchive Wiki
Knowledge Base

Article ID: 106560

Article Last Modified on 12/1/2003


  • Microsoft FORTRAN Compiler 4.0
  • Microsoft FORTRAN Compiler 4.1
  • Microsoft FORTRAN Compiler 5.0
  • Microsoft FORTRAN Compiler 5.1
  • Microsoft FORTRAN Compiler 4.1
  • Microsoft FORTRAN Compiler 5.0
  • Microsoft FORTRAN Compiler 5.1
  • Microsoft FORTRAN PowerStation 1.0 Standard Edition
  • Microsoft FORTRAN PowerStation 32

This article was previously published under Q106560


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).


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.


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

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: kbfix KB106560