FIX: F6099 w/ IAND in an IF Compiled w/ /4Yb and /Od

Last reviewed: September 16, 1997
Article ID: Q86453
m4.00 4.01 4.10 5.00 5.10 | 4.10 5.00 5.10
MS-DOS                   | OS/2
kbtool kbbuglist kbfixlist kberrmsg

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

Programs compiled with the /4Yb (or the $DEBUG metacommand) and /Od switches in Microsoft FORTRAN versions 4.0, 4.01, 4.1, 5.0, and 5.1 under MS-DOS and versions 4.1, 5.0, and 5.1 under OS/2 and that contain an IAND function within an IF statement may incorrectly generate the following error:

   Run-Time Error F6099: $DEBUG
        INTEGER overflow

This error is generated if one of the parameters of the IAND function is a constant less than 255 and the other parameter is a variable greater than 32768.

CAUSE

The F6099 error occurs for constants less than 255 because the /4Yb compiler option (or the $DEBUG metacommand) causes the compiler to generate code for checking integer overflow in which an incorrect comparison is made on the low word of the variable stored in the AX register. A constant greater than 255 in the IAND function forces a comparison on the high word of the register, avoiding the generation of the incorrect overflow error.

RESOLUTION

To avoid this error, compile either without the /4Yb (or the $DEBUG metacommand) or the /Od compiler option.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.01, 4.1, 5.0, and 5.1. This problem was corrected in FORTRAN PowerStation, version 1.0.

MORE INFORMATION

The following code can be used to reproduce the problem.

Sample Code 1

C Compile options needed: /Od

$debug

      integer*4 k
      k=32768
      if (iand(k, 1) .ne. 0) write(*, *) 'Not Equal to Zero'
      end


Additional reference words: 4.00 4.10 5.00 5.10 buglist4.00 buglist4.01
buglist4.10 buglist5.00 buglist5.10 fixlist1.00
KBCategory: kbtool kbbuglist kbfixlist 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.