BUG: YIELDQQ and /MW Cause F2616 Error

Last reviewed: July 11, 1995
Article 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 reference words: 5.10
KBCategory: kbtool kberrmsg kbbuglist
KBSubcategory: FLIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 11, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.