FIX: Bad Jump Calculated in Function Containing an _asm Block

Last reviewed: September 16, 1997
Article ID: Q102162
7.00 | 1.00 MS-DOS | WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE), included with:

        - Microsoft C/C++ for MS-DOS, version 7.0
        - Microsoft Visual C++ for Windows, version 1.0
    

SYMPTOMS

An attempt to run an application fails. When the application runs in the Microsoft Windows operating system, a General Protection (GP) fault occurs. In the MS-DOS operating system, the application may hang or cause the system to crash.

CAUSE

The C++ optimizing compiler generates a bad jump target in the return of a function when the function includes an _asm block that contains floating-point instructions.

RESOLUTION

There are two methods to work around this problem:

  • Specify the /f compiler option switch to compile the code with the fast compiler.
  • Change the name of the source file or specify the /Tc compiler option switch to compile the code with the C compiler.

STATUS

Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in Visual C++ for Windows, version 1.5.

This problem does not occur in Visual C++, 32-bit Edition, version 1.0.

MORE INFORMATION

The following code example demonstrates this problem:

Sample Code

/*
 * Compiler options needed: /f- /AL to demonstrate problem
 * Optional additional options: /Od /Zi
 */

void tdt(double x)
{
   _asm
   {
      fld x
      f2xm1
      ; fptan also causes a bad jmp calculation
      fwait
   }      // Bad JMP instruction
}
void main()
{
   double x1 = 0.4;

   tdt(x1);
}


Additional reference words: 1.00 7.00 8.00
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CLIss
Keywords : CLIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 7.00 | 1.00
Platform : MS-DOS 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.