FIX: ENTRY Statement Not Recognizing VALUE Attribute

Last reviewed: September 16, 1997
Article ID: Q85303
4.00 4.01 4.1 5.00 | 4.10 5.00
MS-DOS             | OS/2
kbprg kbbuglist kbfixlist kbcode

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, and 5.0
  • Microsoft FORTRAN for OS/2, versions 4.1 and 5.0

SYMPTOMS

A program compiled with Microsoft FORTRAN version 4.0, 4.01, 4.1, or 5.0 may generate incorrect results when it includes a subprogram containing an ENTRY statement. For the problem to occur, one of the arguments of the ENTRY statement must be passed by value. This argument must be a different name than the formal argument declared by the subprogram containing the ENTRY statement.

CAUSE

VALUE attributes are incorrectly ignored in INTERFACE statements for subprograms that have an ENTRY statement if the arguments are not identical. Arguments to ENTRY statements are passed in by the default method, by reference, and the subprogram then generates incorrect results.

RESOLUTION

Use a formal parameter for the ENTRY point that exactly matches the name of the formal parameter of the parent function. In this case the following warning may be generated:

   warning F4201: ENTRY : formal argument :attribute VALUE : mismatch

This warning message can be ignored.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN versions 4.0, 4.01, 4.1, and 5.0. This problem was corrected in Microsoft FORTRAN version 5.1.

MORE INFORMATION

Sample Code 1

The following code reproduces the problem:

      interface to subroutine t1(v1[value])
      integer*2 v1
      end

      interface to subroutine et1(v1[value])
      integer*2 v1
      end

      print *, 'Passing a 1 to t1()'
      call t1(1)
      print *
      print *, 'Passing a 10 to et1()'
      call et1(10)
      end


      subroutine t1(v1)
      integer*2 v1, ev1

      print *, 'Value received by t1  =',v1
      return
      ENTRY  et1(ev1)
      print *, 'Value received by et1 =',ev1
      return
      end


Sample Code 2

The following code corrects the problem:

      interface to subroutine t1(v1[value])
      integer*2 v1
      end

      interface to subroutine et1(v1[value])
      integer*2 v1
      end

      print *, 'Passing a 1 to t1()'
      call t1(1)
      print *
      print *, 'Passing a 10 to et1()'
      call et1(10)
      end


      subroutine  t1(v1)
      integer*2 v1

      print *, 'Value received by t1  =',v1
      return
      ENTRY  et1(v1)
      print *, 'Value received by et1 =',v1
      return
      end


Additional reference words: 4.00 4.10 5.00 5.10 buglist4.00 buglist4.10
buglist5.00 fixlist5.10
KBCategory: kbprg kbbuglist kbfixlist kbcode
KBSubcategory: FORTLngIss
Solution Type : kbfix


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: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.