FIX: /Zi and INTERFACE and CHARACTER*(*) Halts Compiler

Last reviewed: September 16, 1997
Article ID: Q84330
5.00 5.10 | 5.10
MS-DOS    | OS/2
kbtool kbfixlist kbbuglist

The information in this article applies to:

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

SYMPTOMS

Using the Microsoft FORTRAN compiler version 5.0 or 5.1 with the /Zi option to compile code that has an INTERFACE statement and the character declaration CHARACTER*(*) may cause the machine to hang under MS-DOS when compiling. Compiling the same program with /Zi under OS/2 may cause a Trap D protection violation to be generated.

CAUSE

This problem occurs when the CHARACTER*(*) declaration is used within the INTERFACE statement, which is very similar to other reported problems compiling code containing INTERFACE statements with the /Zi option. For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q77258
   TITLE: Compiler Hang with /Zi or /Od, INTERFACE Statement

RESOLUTION

Change the specification CHARACTER*(*) to CHARACTER*1 in INTERFACE statements. The size of the character string in the INTERFACE statement is not used by the compiler so any dummy value can be used.

STATUS

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

MORE INFORMATION

Sample Code 1

c The following sample code halts the compiler when compiled with /Zi.

      interface to subroutine s(c)
      character*(*) c
      end

      subroutine s(c)
      character*(*) c
      integer a1(2), a2(2), a3(2), a4(2)
      parameter (i1=1, i=-1)
      end

Sample Code 2

c No error is generated when compiling the following code with /Zi:

c FORTRAN character strings are passed by reference, similar to all c other FORTRAN data. The size of character string c in the INTERFACE c statement is not used by the compiler, so any fixed value solves c the problem.

      interface to subroutine s(c)
      character*1 c     ! Arbitrary size of string assigned here.
      end

      subroutine s(c)
      character*(*) c
      integer a1(2), a2(2), a3(2), a4(2)
      parameter (i1=1, i=-1)
      end


Additional reference words: 5.00 5.10 hang
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 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.