FIX: L1103 and Initialization of Large Common Blocks (58431)



The information in this article applies to:

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

This article was previously published under Q58431

SYMPTOMS

The program below causes the following linker error:
fatal error L1103: attempt to access data outside segment bounds
The program defines a common block of arrays that span multiple segments. The program then initializes the arrays in the common block. The error is generated because the program is initializing the arrays in a different order than they are specified in the common block.

RESOLUTION

The work-around is to initialize the arrays in the same order that they appear in the common block.

NOTE: It is also possible to generate an internal compiler error by making simple modifications to the source code mentioned above. However, the workaround, is the same: initialize arrays in the order they are defined in the common block. For an example, query on the following in this Knowledge Base:

internal and compiler and error and F1001 and line and 185

STATUS

Microsoft has confirmed this to be a problem in FORTRAN version 5.0 and 5.1. This problem was corrected in FORTRAN PowerStation.

MORE INFORMATION

The following program demonstrates the linker error L1103:
C ============ FORTRAN SOURCE CODE == Fragment #1 ===============

      real*8    test1, test2

      common /test/ test1(1000,10), test2(100)

      data test2 /100*0/ 
      data test1 /10000*0/ 

      end
C ===============================================================
				
The workaround is to initialize the arrays in the order they appear in the common block, as shown below.
C ============ FORTRAN SOURCE CODE == Fragment #2 ===============

      real*8    test1, test2

      common /test/ test1(1000,10), test2(100)

      data test1 /10000*0/ 
      data test2 /100*0/ 

      end
C ===============================================================
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:kbfix KB58431