Microsoft KB Archive/67615

= FIX: Protection Violation When Structure Element Used in OPEN =

PSS ID Number: 67615

Article Last Modified on 5/4/2001

-

The information in this article applies to:


 * Microsoft FORTRAN compiler for OS/2 5.0

-



This article was previously published under Q67615



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 query words: 5.00 buglist5.00 fixlist5.10

Keywords: kbbug KB67615

Technology: kbAudDeveloper kbFORTRAN500OS2 kbFortranSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.