FIX: Entire Structure in DATA Fails to Cause Error

Last reviewed: September 16, 1997
Article ID: Q87474
5.00 5.10 1.00 1.00a | 5.00 5.10 | 1.00
MS-DOS               | OS/2      | WINDOWS NT
kbtool kbfixlist

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS versions 5.0 and 5.1
  • Microsoft FORTRAN for OS/2 versions 5.0 and 5.1
  • Microsoft FORTRAN PowerStation for MS-DOS versions 1.0 and 1.0a
  • Microsoft FORTRAN PowerStation 32 version 1.0

SYMPTOMS

Applications compiled with Microsoft FORTRAN version 5.0 or 5.1 that initialize entire structures in DATA statements may produce incorrect results.

CAUSE

Initializing entire structures in a DATA statement is not permitted (Microsoft FORTRAN version 5.1 "Reference" manual, page 140), but no error or warning is emitted by the compiler. Subsequent use of that structure variable may lead to incorrect results.

RESOLUTION

To initialize structure variables through DATA statements, specify every element of the structure separately.

STATUS

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

MORE INFORMATION

The following code fails to produce any error message and the resulting output is incorrect:

Sample Code #1

       structure /test/
          integer i
          real    x
       end structure
       record /test/ s
       data s /7/
       print*, s.i, s.x
       end

The following code demonstrates the correct use of a structure variable in a DATA statement:

Sample Code #2

       structure /test/
          integer i
          real    x
       end structure
       record /test/ s
       data s.i /7/, s.x /7.0/
       print*, s.i, s.x
       end


Additional reference words: 1.00 5.00 5.10
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: FLIss
Keywords : FLIss kbbuglist kbfixlist kbtool
Version : 5.00 5.10 1.00 1.00a | 5.00 5.10
Platform : MS-DOS NT OS/2 WINDOWS
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 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.