Microsoft KB Archive/68528

= FIX: Incorrect Results Writing Array of Structure Variables =

Article ID: 68528

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.0

-



This article was previously published under Q68528



SYMPTOMS
An application produces incorrect results when it writes an array of structure variables. An attempt to compile the application with the patched High-Capacity FORTRAN version 5.0 compiler (F1L.EXE) and link for OS/2 fails and Microsoft LINK generates the following message:

Error L2002: fixup overflow at 13 in segment _DATA

The application runs correctly when you compile it with the unpatched versions of the Microsoft FORTRAN version 5.0 F1.EXE or F1L.EXE file.



CAUSE
The application was compiled with the patched version of the F1.EXE file or with the patched F1L.EXE file.



RESOLUTION
To address this problem, perform one of the following two steps:


 * Modify the source code to change the structure variable to a one-element array.
 * Modify the source code to assign the structure variable to a temporary variable and specify the temporary variable in the output statement.



STATUS
Microsoft has confirmed this to be a problem in the patched version of FORTRAN version 5.0 for MS-DOS and OS/2. This problem was corrected in FORTRAN version 5.1 for MS-DOS and OS/2.



MORE INFORMATION
Among other things, the F1.EXE patch corrects the following error:

F1001: Internal Compiler Error

compiler file omf_ms.c:1.118, line 1093

This error often occurs when an application performs an I/O operation on the elements of a structure after passing that structure to a subprogram.

The High-Capacity Compiler, F1L.EXE, is an alternate form of the first compiler pass. Use the High-Capacity Compiler when an attempt to compile an application with the regular compiler fails and generates the following message:

F1901: program too large for memory

The following code example demonstrates this problem.

Sample Code #1
C Compile options needed: None

STRUCTURE / REC / CHARACTER*12 NUM END STRUCTURE RECORD / REC / ALLREC(3) ALLREC(1).NUM = 'ONE' ALLREC(2).NUM = 'TWO' ALLREC(3).NUM = 'THREE' 10   FORMAT(' ', A12) DO 20 I = 1, 3 WRITE(*, 10) ALLREC(I).NUM  ! Outputs &quot;ONE&quot; for each iteration 20   CONTINUE END In the following code example, NUM is a one element array. The program produces the expected output.

Sample Code #2
C Compile options needed: None

STRUCTURE / REC / CHARACTER*12 NUM END STRUCTURE RECORD / REC / ALLREC(3) ALLREC(1).NUM = 'ONE' ALLREC(2).NUM = 'TWO' ALLREC(3).NUM = 'THREE' 10   FORMAT(' ', A12) DO 20 I = 1, 3 WRITE(*, 10) ALLREC(I).NUM  ! Outputs &quot;ONE&quot; for each iteration 20   CONTINUE END

Additional query words: 5.00 buglist5.00 fixlist5.10

Keywords: kbfix KB68528

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.