FIX: Incorrect Results from Alternate Returns and $STORAGE:2

ID: Q77557

5.10 | 5.10 MS-DOS | OS/2 kbtool kbfixlist kbbuglist ---------------------------------------------------------------------- The information in this article applies to: - Microsoft FORTRAN for MS-DOS, versions 5.1 - Microsoft FORTRAN for OS/2, version 5.1 ---------------------------------------------------------------------- SYMPTOMS ======== Microsoft FORTRAN code that uses alternate RETURNS and is compiled with $STORAGE:2 metacommand in the called subprogram and $STORAGE:4 (the default) in the calling routine may not return to the correct alternate return label number. This will cause incorrect results. CAUSE ===== When the $STORAGE:2 metacommand is in the separately compiled subroutine with the alternate return, the AX register is correctly initialized with the return code but the DX register is not correctly initialized (zeroed), resulting in incorrect operation of the calling program. There is a CWD (convert to double word using DX:AX) missing in the generated code for the called subprogram. The calling routine acts on the fact that DX is not zero and branches to the next executable statement and not the correct alternate return label. STATUS ====== Microsoft has confirmed this to be a problem in the products listed above. This problem was corrected in FORTRAN PowerStation. MORE INFORMATION ================ The following code reproduces the problem: Calling routine (in separate file): ---------------- PROGRAM TEST CALL SUB1(*90) PRINT *, 'ERROR - NORMAL RETURN' STOP 90 PRINT *, 'CORRECT - ALTERNATE RETURN' STOP END Called subprogram (in separate file): ------------------------------------- $STORAGE:2 SUBROUTINE SUB1(*) RETURN 1 END Additional reference words: 5.10 buglist5.10 fixlist1.00 KBCategory: kbtool kbfixlist kbbuglist KBSubCategory: FLIss

Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: January 25, 1995