FIX: Compiler Hangs When Adjustable-Size Array Used ImproperlyLast reviewed: September 11, 1997Article ID: Q67515 |
5.00 | 5.00
MS-DOS | OS/2
kbtool kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSAn attempt to compile an application in MS-DOS fails and the computer hangs. An attempt to compile the same application in OS/2 fails and the compiler prints some high-ASCII characters on the screen followed by a protection violation message. An attempt to compile the application with Microsoft FORTRAN versions 4.0 or 4.1 fails and the compiler generates one of the following messages:
F2841: adjustable-size array: not reference argument F2339: adjustable-size array not in subprogram CAUSEThe application contains an adjustable size array that is not a formal argument to a subprogram.
RESOLUTIONTo address this problem, perform one of the following steps:
STATUSMicrosoft has confirmed this to be a problem in 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 INFORMATIONOn page 145, the Microsoft FORTRAN "Reference" manual for versions 5.0 and 5.1 explains how an adjustable sized array must be a formal argument of the program unit in which the array appears. On the other hand, an allocatable array must not be a formal argument. For more information on allocatable arrays, see pages 25 and 113 of the "Reference" manual. The following code example reproduces this problem in a subprogram.
Sample Code #1C Compile options needed: None
SUBROUTINE A (B, C) DIMENSION B(1, 1), D(C, 1, 1) E = 1 D(E, E, E) = D(1, 1, 1) + B(1, 1) * D(1, 1, 1) ENDThe error depends on both the assignment statements and arithmetic in the second statement. For example, if you change the left-hand side of the equation in the second assignment statement to "D(1, 1, 1)" from "D(E, E, E)," the compiler generates the correct error message. The following code example reproduces this problem in a main program.
Sample Code #2C Compile options needed: None
DIMENSION B(1, 1), D(C, 1, 1) E = 1 D(E, E, E) = D(1, 1, 1) + B(1, 1) * D(1, 1, 1) END |
Additional reference words: 5.00 buglist5.00 fixlist5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |