FIX: Protection Violation When Structure Element Used in OPEN

Last reviewed: September 11, 1997
Article ID: Q67615
5.00 OS/2 kbtool kbfixlist kbbuglist

The information in this article applies to:

  • Microsoft FORTRAN for OS/2, version 5.0

SYMPTOMS

An attempt to compile an application fails and the compiler generates a protection violation.

CAUSE

The application uses an element of a structure as the filename in an OPEN statement.

RESOLUTION

To work around this problem, perform one of the following two steps:

  • Modify the source code to assign the value of the structure member to a temporary variable and specify the variable in the OPEN statement.
  • Compile the application in MS-DOS.

STATUS

Microsoft has confirmed this to be a problem in the 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 code example below demonstrates this problem.

Sample Code #1

C Compile options needed: None

      PROGRAM TEST
      STRUCTURE /IO/
        CHARACTER*12 NAME
      END STRUCTURE
      RECORD /IO/ IOINST
      IOINST.NAME = 'TEST.DAT'
      OPEN (10, FILE = IOINST.NAME)
      END

The code example below alleviates this problem by using the temporary variable TMP to hold the filename.

Sample Code #2

C Compile options needed: None

      PROGRAM TEST
      STRUCTURE /IO/
        CHARACTER*12 NAME
      END STRUCTURE
      CHARACTER*12 TMP
      RECORD /IO/ IOINST
      IOINST.NAME = 'TEST.DAT'
      TMP = IOINST.NAME
      OPEN (10, FILE = TMP)
      END


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