FIX: INTEGER*1 Items Passed by Value Incorrectly

ID: Q77690


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, version 5.1
  • Microsoft FORTRAN for OS/2, version 5.1


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 :
Version : :5.1
Platform :
Issue type :


Last Reviewed: November 1, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.