FIX: Incorrect Range Checking with Arrays Dimensioned (1)Last reviewed: September 16, 1997Article ID: Q106560 |
1.00
MS-DOS
kbtool kbfixlist kbbuglist
fixlist1.00a
The information in this article applies to:
SYMPTOMSExtended 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).
STATUSMicrosoft 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 INFORMATIONThe 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 reference words: 1.00 4.00 4.00a 4.10 5.00 5.10 buglist1.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |