FIX: Incorrect Results, F4803 Error, Function ENTRY StatementLast reviewed: September 10, 1997Article ID: Q24628 |
4.00 4.00A 4.01 4.10 5.00 | 4.10 5.00
MS-DOS | OS/2kbprg kbfixlist kbbuglist kbcode The information in this article applies to:
SYMPTOMSAn application generates incorrect results. When FORTRAN for MS-DOS versions 4.0, 4.0a, or 4.01 compiles the program, the compiler generates the following message:
warning F4803 FUNCTION : return variable not set CAUSEThe problem occurs because the compiler requires the return value of an entry to be set using the entry name. The ANSI FORTRAN-77 standard states that the return value can be set using the entry name or the original function name if they have the same type.
RESOLUTIONTo work around this problem, set the return value of a entry that is part of a function by using the entry name instead of the function name.
STATUSMicrosoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.0a, 4.01, 4.10, and 5.00 for MS-DOS and versions 4.1 and 5.0 for OS/2. This problem was corrected in FORTRAN version 5.10 for MS-DOS and OS/2.
MORE INFORMATIONPages 15-12 and 15-13 of the ANSI FORTRAN-77 standard include the following statement.
15.7.3 Entry Association. Within a function subprogram, all variables whose names are also the names of entries are associated with each other and with the variable, if any, whose name is also the name of the function subprogram (17.1.3). Therefore, any such variable that becomes defined causes all associated variables of the same type to become defined and all associated variables of different type to become undefined.Therefore, it should be possible to set the return value of an entry that belongs to a function through the function name or the entry name if both have the same type. The following code example demonstrates this problem.
Sample Code #1C Compile options needed: None
PROGRAM TEST INTEGER FUN1, ENT1 WRITE (*, *) FUN1(3), ENT1(3) END INTEGER FUNCTION FUN1(I) INTEGER ENT1 FUN1 = I RETURN ENTRY ENT1(I) FUN1 = 2 * I RETURN ENDThe following code example demonstrates one method to avoid this problem.
Sample Code #2C Compile options needed: None
PROGRAM TEST INTEGER FUN1, ENT1 WRITE (*, *) FUN1(3), ENT1(3) END INTEGER FUNCTION FUN1(I) INTEGER ENT1 FUN1 = I RETURN ENTRY ENT1(I) ENT1 = 2 * I RETURN END |
Additional reference words: 4.00 4.00a 4.01 4.10 5.00 buglist4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |