BUG: Incorrect Results or Hanging with INTDOSXQQ() (76669)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q76669

SYMPTOMS

A program compiled with Microsoft FORTRAN version 5.1 may generate incorrect results, hang the machine under MS-DOS, or generate a protection violation under OS/2 if the program makes a call to the MS-DOS interrupt function subroutine INTDOSXQQ().

CAUSE

The include file FLIB.FI declares the arguments to INTDOSXQQ() to be passed by value, when they should be passed by reference. This corrupts the stack causing unpredictable results.

RESOLUTION

Modify the FLIB.FI file to contain the REFERENCE attribute on the arguments to INTDOSXQQ(). The lines look like this:
      RECORD /REGS$INFO/ REGS1
      RECORD /REGS$INFO/ REGS2
      RECORD /SREGS$INFO/ SREGS
      END
				
and should be modified to be:
      RECORD /REGS$INFO/ REGS1 [REFERENCE]
      RECORD /REGS$INFO/ REGS2 [REFERENCE]
      RECORD /SREGS$INFO/ SREGS [REFERENCE]
      END
				

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and OS/2.

This article does not apply to FORTRAN PowerStation.

MORE INFORMATION

The following code reproduces the problem:

Sample code

       include 'flib.fi'
       implicit none
       include 'flib.fd'
       character*64 string[c]
       integer address
       integer*2 addresspart(2)
       record /regs$info/ in,out
       record /sregs$info/ seg
       equivalence (address,addresspart(1))
       address=locfar(string)
       in.wregs.ax=#4700
       in.wregs.bx=#0000
       in.wregs.cx=#0000
       in.wregs.dx=#0000
       in.wregs.si=addresspart(1)
       in.wregs.di=#0000
       in.wregs.cflag=#0000
       seg.es=#0000
       seg.ds=addresspart(2)
       CALL INTDOSxQQ(IN,OUT,seg)   ! this call returns nothing
       WRITE(*,1000) STRING
       STOP
 1000 FORMAT(1x,'THE Current Directory Is: ',A)
       END
				

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:KB76669