FIX: F1001: grammar.c, Line 101, Assumed-Size Array

Last reviewed: September 16, 1997
Article ID: Q86454
4.00 4.01 4.10 5.00 | 4.10 5.00
MS-DOS              | OS/2
kbtool kbfixlist kbbuglist kberrmsg 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

Compiling a program that uses the C attribute in an INTERFACE statement to a subprogram that accepts an assumed-size array as an argument may generate the following error with Microsoft FORTRAN version 5.0:

   fatal error F1001: Internal Compiler Error
                      (compiler file '@(#)grammar.c:1.2',line 101)

FORTRAN versions 4.0, 4.01, and 4.1 generate the following error:

   fatal error F1001: Internal Compiler Error
                      (compiler file '@(#)grammar.c:1.27',line 101)

CAUSE

There are two similar ways to cause this internal compiler error:

  • Compile code that has a C attribute on a subprogram name in an INTERFACE statement when the subprogram has an assumed size array as a formal argument and the REFERENCE attribute is not specified on the array name.

    -or-

  • Compile code that has a C attribute on a subprogram name in an EXTERNAL statement when the subprogram is passed an array as an argument.

RESOLUTION

Use one of the following workarounds:

  • Put the REFERENCE attribute on array formal arguments in the INTERFACE statement to prevent the problem from occurring. This is the only way to pass arrays and is only making explicit what is implicit functionality with the C attribute.

    -or-

  • Do not use put the C attribute on names using the EXTERNAL statement. Use the INTERFACE statement instead.

STATUS

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

MORE INFORMATION

The following code can be used to generate the error:

Sample Code 1

      interface to subroutine sub1[c] (array)
      integer array(*)
      end

      integer array(10)
      call sub1(array)
      end

The following code also generates the error:

Sample Code 2

      external sub1[c]
      integer array(10)
      call sub1(array)
      end

The following code corrects the problem and does not generate the error:

Sample Code 3

      interface to subroutine sub1[c] (array)
      integer array[reference](*)
      end

      integer array(10)
      call sub1(array)
      end


Additional reference words: 4.00 4.10 5.00 5.10 buglist4.00 buglist4.10
buglist5.00 fixlist5.10
KBCategory: kbtool kbfixlist kbbuglist 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.