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

ID: Q87981


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 4.0, 4.01, 4.1, 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 4.1, 5.0, 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 query words: 4.00 4.10 5.00 5.10

Keywords :
Version : :4.0,4.01,4.1,5.0,5.1
Platform :
Issue type :


Last Reviewed: November 1, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.