PRB: 486, Subroutine Array Element Crosses Segment (77461)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q77461

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
				

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:KB77461