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



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 4.0
  • Microsoft FORTRAN Compiler for MS-DOS 4.01
  • Microsoft FORTRAN Compiler for MS-DOS 4.1
  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN compiler for OS/2 4.1
  • Microsoft FORTRAN compiler for OS/2 5.0

This article was previously published under Q86454

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
				

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:kbfix KB86454