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

ID: Q86454


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0
  • Microsoft FORTRAN for OS/2, versions 4.1, 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 query words: 4.00 4.10 5.00 5.10 buglist4.00 buglist4.10 buglist5.00 fixlist5.10

Keywords :
Version : :4.0,4.01,4.1,5.0
Platform :
Issue type :


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