FIX: Mixed Type Expressions Cause F2124: Code Generation ErrorLast reviewed: September 11, 1997Article ID: Q69762 |
4.00 4.10 5.00 5.10 | 4.10 5.00 5.10
MS-DOS | OS/2kbtool kbfixlist kbbuglist kberrmsg kbcode The information in this article applies to:
SYMPTOMSUsing Microsoft FORTRAN 5.0 or 5.1 to compile a program that uses mixed data types in an expression can cause the compiler to hang the machine under DOS, generate a protection violation under OS/2, or result in the following error:
F2124: Code Generation ErrorIn some cases, the compiler will generate the following error:
fatal error F1001: Internal Compiler Error (compiler file '@(#)mactab.c:1.2', line 663)Explicitly converting all variables and constants to the same type will suppress the error. In some cases, the error is suppressed by optimization (for example, using /Ox, or by not using the /Od compiler option during compilation). In other cases, the problem is more severe when using optimization.
CAUSEThe following sample programs illustrate the problems.
Using COMPLEX and REAL Data Types
subroutine x(a,c,d) complex*16 a, d, b b = (1.0,0) a = a * (-b) * c * d return endThe above program must be compiled with the /Od switch to cause the code generation error. In some cases, the /FPc option may be necessary to generate F2124. Using COMPLEX instead of COMPLEX*16 will generate the following error:
fatal error F1001: Internal Compiler Error (compiler file '@(#)mactab.c:1.2', line 663) Using REAL and INTEGER Data Types
real a,b,c b = 1.0 c = 2.0 a = 4 * b * (-1) * c endCompiling this program under DOS without the /Od compiler option will cause the compiler to hang the computer. When compiling under OS/2, a protection violation is generated by the second pass of the compiler. Using the /Od compiler option results in the following error:
F2124: Code Generation Error RESOLUTIONExplicitly converting the type of all of the variables or constants to the same type will prevent the errors, as illustrated by the following sample programs:
Using COMPLEX and REAL Data Types
subroutine x(a,c,d) complex*16 a, d, b b = (1.0,0) a = a * (-b) * dcmplx(c) * d ! Convert real data type to ! double precision complex ! data type to match other ! types. return end Using REAL and INTEGER Data Types
real a,b,c b = 1.0 c = 2.0 a = 4.0 * b * (-1.0) * c ! Convert integer constants ! to real constants to match ! other types. end STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN versions 5.0 and 5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN PowerStation.
|
Additional reference words: 5.00 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |