BUG: YIELDQQ and /MW Cause F2616 Error

ID: Q84623


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


SYMPTOMS

Code containing a call to the subroutine YIELDQQ compiled with the /MWn option, where n is not 0, may cause the Microsoft FORTRAN Compiler version 5.1 to generate the following error:

error F2616: YIELDQQ : illegal use of function or subroutine


CAUSE

Compiling QuickWin programs with /MWn (n not equal to 0) causes the compiler to insert calls to a function YIELDQQ() in different locations throughout the code depending on the value of n. The compiler sees these calls to the YIELDQQ function, and thereafter considers the YIELDQQ symbol to be a reference to a function instead of a subroutine. This is despite the INTERFACE statement in the file FLIB.FI describing YIELDQQ as a subroutine. The compiler subsequently reports this perceived inconsistency with the F2616 error.


RESOLUTION

The easiest solution is to compile with /MW0 to suppress all compiler generated calls to the YIELDQQ function. Alternatively, all calls to the subroutine YIELDQQ within the code may be removed or modified to call YIELDQQ as a function instead of a subroutine. In this case, if the compiler option /MWn is used (n greater than zero), the INTERFACE statement in FLIB.FI must be modified to declare YIELDQQ as a function instead of a subroutine if an explicit function call to YIELDQQ is made before the compiler inserts a YIELDQQ function call.


STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1.

This is not an issue in FORTRAN PowerStation because the /MW option is not supported.


MORE INFORMATION

Sample Code 1


c The most common example of a situation that exhibits this F2616 error
c is using the /MW option (which is the same as /MW1) to compile code
c containing a call to YIELDQQ within a DO-loop:

      include 'flib.fi'
      include 'flib.fd'

      do i=1, 10
        call yieldqq
      end do
      end 

Sample Code 2


c The following code will not generate the F2616 error if compiled with
c /MW:

      include 'flib.fi'
      include 'flib.fd'

      integer*2 dummy, yieldqq

      do i=1, 10
        dummy = yieldqq()
      end do
      end 
If a reference to YIELDQQ is made prior to the DO-loop then the F2616 error will again be generated. To avoid this problem modify the following entry in FLIB.FI:

       INTERFACE TO SUBROUTINE YIELDQQ()
       END 
To:

       INTERFACE TO INTEGER*2 FUNCTION YIELDQQ()
       END 

Additional query words: nofps 5.10

Keywords :
Version : :5.1
Platform :
Issue type :


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