FIX: ALLOCATABLE on Formal Argument Gives No Error

Last reviewed: September 16, 1997
Article ID: Q86391
5.00 | 5.00 MS-DOS | OS/2 kbtool kbbuglist kbfixlist kberrmsg

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, version 5.0
  • Microsoft FORTRAN for OS/2, version 5.0

SYMPTOMS

The Microsoft FORTRAN 5.0 compiler fails to output an error message when the ALLOCATABLE attribute is placed on a formal argument of a subprogram. The following run-time error is generated when executing this code in either MS-DOS or OS/2:

   run-time error F6316: ALLOCATE
   - array already allocated

The following compiler error should be generated:

      F2420 : (arrayname) : ALLOCATABLE: dummy argument illegal

RESOLUTION

Avoid using the ALLOCATABLE attribute on formal arguments.

STATUS

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

MORE INFORMATION

Page 145 of the "Microsoft FORTRAN Reference" version 5.0 manual states that ALLOCATABLE arrays must not be formal arguments.

Sample Code

The following code reproduces the problem:

      integer base,size

      call sub1(base,size)
      end

      subroutine sub1(base,size)
      integer base [allocatable] (:)
      integer size
      allocate (base(size))
      return
      end


Additional reference words: 5.00 5.10 buglist5.00 fixlist5.10
KBCategory: kbtool kbbuglist kbfixlist kberrmsg
KBSubcategory: FLIss
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.