FIX: F1001 ctypes.c:1.21, Line 1655: ISHFT

Last reviewed: September 16, 1997
Article ID: Q87981
4.00 4.01 4.10 5.00 5.10 | 4.10 5.00 5.10
MS-DOS                   | OS/2
kbtool kbfixlist kbbuglist kberrmsg kbcode

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, and 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, and 5.1

SYMPTOMS

Using Microsoft FORTRAN compiler version 4.0, 4.01, 4.1, 5.0, or 5.1 under MS-DOS or version 4.1, 5.0, 5.1 under OS/2 to compile code that contains the intrinsic function ISHFT in a calculation that results in the smallest representable negative integer may cause the compiler to hang the machine under MS-DOS or to generate SYS1942 error TRAP 000C under OS/2.

Using the compiler options /Zi or /Od (both at the same time or separately) may cause the following errors to be generated:

  • Version 5.1: options /Zi or /Od or both

    Under MS-DOS:

          fatal error F1001: Internal Compiler Error
    
              (compiler file '@(#)ctypes.c:1.12', line 1655)
    
       Under OS/2:
    
          SYS1943, TRAP 000D
    
    
    
  • Version 5.0: options /Zi or /Od or both

    Under MS-DOS and OS/2:

         fatal error F1001: Internal Compiler Error
    
             (compiler file '@(#)ctypes.c:1.11', line 1657)
    
    
    
  • Version 4.1: options /Zi and /Od

    Under MS-DOS:

         fatal error F1001: Internal Compiler Error
    
             (compiler file '@(#)ctypes.c:1.89', line 1601)
    
         Run-time R6001
         -null pointer assignment
    
       Under OS/2:
    
         protection violation, SYS1943, TRAP 000D
    
    
  • Version 4.1: options /Zi or /Od separately

    Under MS-DOS: hangs machine

    Under OS/2 using /Zi:

         SYS1942,TRAP 000C
    

    Under OS/2 using /Od:

         SYS1943, TRAP 000D
    
  • FORTRAN versions 4.0 and 4.01 under MS-DOS hang the machine.

CAUSE

Because the expression involves constants and not variables, the compiler attempts to calculate the expression at compile time. The compiler is incorrectly dealing with the special case of the smallest representable integer value. An internal compiler overflow results in the errors.

RESOLUTION

Assign the value of the constants to variables and use variables in the expression.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.01, 4.1, 5.0 and 5.1. We are researching this problem and will post new information here as it becomes available.

MORE INFORMATION

The following code can be used to reproduce the problem:

Sample Code #1

        integer*4 ivar1
        ivar1=ISHFT(1,31)+1  ! ISHFT(1,31)=-2147483648 causes
                             ! compiler overflow error
        stop
        end

The following code demonstrates a solution:

Sample Code #2

        integer*4 ivar1, ivar2, ivar3
        ivar2=1
        ivar3=31
        ivar1=ISHFT(ivar2,ivar3)+1
        stop
        end


Additional reference words: 4.00 4.10 5.00 5.10
KBCategory: kbtool kbfixlist kbbuglist kberrmsg
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.