FIX: F1001 or Protection Violation, Structure Member Array I/O

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

The information in this article applies to:

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

SYMPTOMS

An attempt to compile an application in the OS/2 operating system fails and the third pass of the compiler generates a protection violation.

An attempt to compile the application in the MS-DOS operating system fails and the compiler generates the following messages:

   warning F4202: (subroutine name) : formal argument : never used

   fatal error F1001: Internal Compiler Error
   (compiler file '@(#)omf_ms.c:1.118', line 1093)
   Contact Microsoft Technical Support

The patched version of F1.EXE, which is designed to correct structure element I/O in subroutines, produces the same results as the unpatched version.

CAUSE

The application passes a structure that contains an array to a subroutine. The subroutine specifies the entire structure element array (no subscript) in an I/O statement.

RESOLUTION

Use an implied-DO list to read or write the entire array.

STATUS

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

MORE INFORMATION

The following code example demonstrates this problem.

Sample Code #1

C Compile options needed: None

      STRUCTURE /T/
         INTEGER J(100)
      END STRUCTURE
      RECORD /T/ ST
      CALL SUB(ST)
      END
C
      SUBROUTINE SUB(ST)
        STRUCTURE /T/
          INTEGER J(100)
        END STRUCTURE
      RECORD /T/ ST
      WRITE(*, *) ST.J    ! Writes an entire array (no subscript).
      END

The following code example demonstrates one method to work around this problem.

Sample Code #2

C Compile options needed: None

      STRUCTURE /T/
         INTEGER J(100)
      END STRUCTURE
      RECORD /T/ ST
      CALL SUB(ST)
      END

      SUBROUTINE SUB(ST)
        STRUCTURE /T/
          INTEGER J(100)
        END STRUCTURE
      RECORD /T/ ST
      WRITE(*,*) (ST.J(I), I = 1, 100) ! Uses an implied DO list.
      END


Additional reference words: 5.00 buglist5.00 fixlist5.10
KBCategory: kbtool kbfixlist kbbuglist kberrmsg kbcode
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 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.