PRB: 486, Subroutine Array Element Crosses Segment

ID: Q77461


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, version 5.1
  • Microsoft FORTRAN for OS/2, version 5.1


SYMPTOMS

Programs may generate a protection violation under OS/2 or hang the machine under MS-DOS when that program passes a HUGE array element to a subroutine. In most cases, the coproccesor must be used for the error to occur.

The element from the HUGE array must be contained after the first 64K segment of the HUGE array.


CAUSE

The compiler does not check every array access to verify if it crosses a segment boundary, and was not designed to do so.


RESOLUTION

Try using the HUGE memory model by compiling with /AH to allow arrays to span segments.

This is not an issue in FORTRAN PowerStation.


MORE INFORMATION

The following code reproduces the error:


      real x(16385)
      x=1.
      call y(x(16384))
      end

      subroutine y(x1)
      real*8 x1,z
      z = x1 + 1.d0
      write(*,*) x1, z
      end 

Additional query words: 5.10

Keywords :
Version : :5.1
Platform :
Issue type :


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