Microsoft Knowledge Base Email Alertz

(74220) - Compiling code using Microsoft FORTRAN versions 4.0, 4.01, 4.1, and 5.0 under MS-DOS, and versions 4.1 and 5.0 under OS/2, when that code contains a subroutine with nested DO-loops in which arrays are indexed using a DO variable from an outer DO-loop,...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 74220 - Last Review: December 1, 2003 - Revision: 2.0

FIX: F1001: Grammar.c Line 91; Nested DO-Loops with Arrays

This article was previously published under Q74220

On This Page

SYMPTOMS

Compiling code using Microsoft FORTRAN versions 4.0, 4.01, 4.1, and 5.0 under MS-DOS, and versions 4.1 and 5.0 under OS/2, when that code contains a subroutine with nested DO-loops in which arrays are indexed using a DO variable from an outer DO-loop, may generate the following error:
fatal error F1001: Internal Compiler Error
(compiler file '../../../P2/grammar.c', line 91)

RESOLUTION

The error can be suppressed by turning off loop optimization, using a temporary variable in place of the DO variable from the outer DO-loop, or by upgrading to FORTRAN 5.1.

STATUS

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

MORE INFORMATION

This error is caused by a problem with loop optimization. The following code generates the F1001 error:

Sample code

       subroutine test(a,b,n)

      real*8 a(6,12), b(6,6)

      do 20 i=1,n
        do 10 j=1,n
          a(i,j+n)=b(i,j)
10      continue
20    continue
      return
      end
				
Compiling with the /Od option or with the /Odct options suppresses the error. Microsoft FORTRAN version 5.1 will not generate the error.

If a temporary variable is used in place of the DO variable "i" in the array subscript, the error will not generated. This allows full optimization to be used when compiling. The following code demonstrates this solution:
       subroutine test(a,b,n)

      real*8 a(6,12), b(6,6)

      do 20 i=1,n
        ii = i              ! Temporary variable assigned value of i
        do 10 j=1,n
          a(ii,j+n)=b(ii,j) ! Temporary variable used in place of i
10      continue
20    continue
      return
      end
				

APPLIES TO
  • Microsoft FORTRAN Compiler 4.0
  • Microsoft FORTRAN Compiler 4.01
  • Microsoft FORTRAN Compiler 4.1
  • Microsoft FORTRAN Compiler 5.0
  • Microsoft FORTRAN Compiler 4.1
  • Microsoft FORTRAN Compiler 5.0
Keywords: 
kbfix KB74220
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate