Article ID: 72760 - Last Review: December 12, 2003 - Revision: 2.0 FIX: F2124 or Incorrect Results From Structure Array UseThis article was previously published under Q72760 On This PageSYMPTOMS
An attempt to compile an application fails and the compiler may generate
the following message:
F2124: CODE GENERATION ERROR Contact Microsoft Technical Support CAUSE
The application declares an array of structures that contain REAL*4
elements, REAL*8 elements, or mixed-type elements (for example, one
INTEGER*4 element and one COMPLEX*8 element). The application attempts to
write the entire array without specifying a subscript.
The same code generation error can occur if the application declares an assumed-size array in a subprogram and the compiler command line specifies the /Od compiler option switch. In this case, the types of the structure elements do not effect the error. If the command line does not include /Od compiler option switch, the error message may not appear, but the application does not produce any output. Neither the ANSI FORTRAN 77 standard nor Microsoft FORTRAN supports printing an entire assumed-size array. The compiler is designed to generate the following error message in this case:
F2727: assumed-size array illegal here
RESOLUTION
To address this error, modify the source code to print each element of the
array individually instead of all at once.
STATUS
Microsoft has confirmed this to be a problem in FORTRAN versions 5.0 and
5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN
PowerStation, version 1.0.
MORE INFORMATION
The following code example demonstrates this problem.
Sample Code #1Sample Code #2Sample Code #3An application cannot print an assumed-size array as an array. The application must specify a subscript and print each element individually. One solution to this problem is to use an adjustable- sized array. Pass the length of the structure array to the subprogram with the array itself. Use the array length to terminate the loop that prints the individual array elements. The following code example demonstrates this process. Sample Code #4 | Article Translations
|

Back to the top
