Microsoft KB Archive/77690

= FIX: INTEGER*1 Items Passed by Value Incorrectly =

Article ID: 77690

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q77690



SYMPTOMS
If a FORTRAN program attempts to pass an INTEGER*1 item to a subprogram by value, incorrect results may be generated.



CAUSE
The call to the subprogram pushes two bytes on the stack for the one-byte variable, causing the stack to be misaligned and the variable to be incorrectly accessed in the called routine.



RESOLUTION
The only reliable way to avoid this problem is to pass INTEGER*1 variables by reference.



STATUS
Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in FORTRAN Powerstation, version 1.0.



MORE INFORMATION
The following code can be used to reproduce the problem:

Sample code
subroutine sub1 (i,n) integer*1 i[value],n[value]

write(*,*) i,n i= 44 n= 55 end

integer*1 i,n i = 4 n = 5 call sub1(i,n) write(*,*) i,n end

Additional query words: 5.00 5.10 buglist5.10 fixlist1.00

Keywords: KB77690

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.