PRB: Self-Referential Array Access Incorrect, Array Size > 64K
PSS ID Number: Q10671
Article last modified on 02-09-1993

3.20

MS-DOS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FORTRAN for MS-DOS, version 3.2
----------------------------------------------------------------------

Summary:

SYMPTOMS
   An array access in an application is incorrect.

CAUSE
   The array is larger than 64K in size an the array subscript
   expression refers to the accessed array.

RESOLUTION
   To avoid this problem, do not subscript an array with itself if the
   array is larger than 64K.

STATUS
   Microsoft has confirmed this to be a problem in FORTRAN version 3.2
   for MS-DOS. This problem was corrected in FORTRAN version 3.3 for
   MS-DOS.

More Information:

The following code example demonstrates this behavior.

Sample Code
-----------

C Compile options needed: None

      PROGRAM TEST
      DIMENSION IA(20000)
      DIMENSION IB(10)

      WRITE(*, '(12H LENGTH >64K)')
      DO 15 I = 1, 10
         IA(I) = I
   15 WRITE(*, *) I, IA(I), IA(IA(I))

      WRITE(*, '(12H LENGTH <64K)')
      DO 18 I = 1, 10
         IB(I) = I
   18 WRITE(*,*) I, IB(I), IB(IB(I))
      END

Additional reference words: 3.20

=============================================================================

Copyright Microsoft Corporation 1993.
