FIX: Implied DO-loop with DATA, Structure Causes F1900

ID: Q84327

The information in this article applies to:

SYMPTOMS

When attempting to initialize an array of structure elements with a DATA statement that uses an implied DO-loop, the Microsoft FORTRAN 5.1 compiler may generate the following error under MS-DOS:

   fatal error F1900: maximum memory-allocation size exceeded

A trap C with the following error message may be generated under OS/2:

   SYS1942: A program attempted to reference storage outside the
   limits of a stack segment. The program was ended.

These messages occur only when the data being initialized in the implied DO- loop of the DATA statement is of type CHARACTER.

RESOLUTION

To initialize an array of record elements of type CHARACTER, use assignment statements or read the data from an external file.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN PowerStation, version 1.0.

MORE INFORMATION

The following code produces the F1900 error when compiled under MS-DOS, and the SYS1942 error when compiled under OS/2:

Sample Code 1

      structure /s/
         character*2 ch
      end structure
      record /s/ a(20)
      data (a(j).ch,j=1,3) /'h ','he','hj'/
      end

The example below shows how assignment statements may be used to initialize the array of CHARACTER record elements:

Sample Code 2

      structure /s/
         character*2 ch
      end structure
      record /s/ a(20)
      logical flag /.true./
c
      if (flag) then
         flag=.false.
         a(1).ch='h '   ! assignment statements
         a(2).ch='he'
         a(3).ch='hj'
      endif
      end

Additional query words: 5.10 buglist5.10 fixlist1.00
Keywords          : kberrmsg kbtool
Version           : 5.1 | 5.1
Platform          : MS-DOS OS/2
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: May 11, 1998