FIX: System Hang with /Oe Option and Switch Statements

Last reviewed: September 18, 1997
Article ID: Q114073
1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

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

        - Microsoft Visual C++ for Windows, version 1.0
    

SYMPTOMS

When compiling a source module, the C/C++ compiler may cause the system to hang and not respond if all of the following conditions exist:

  1. The code is being compiled with the /Oe (Enable Global Register Allocation) optimization.

  2. The source code contains a switch statement where the switch expression contains a function call. For example:

           switch ( my_fcn( 100 ) ) { ... }
    

  3. The same function that contains the switch statement has a call to setjmp().

RESOLUTION

To work around the problem, change the switch statement so the switch expression does not contain a function call. Alternatively, avoid using /Oe when compiling the module, or use the #pragma optimize() directive to disable /Oe for the function with the switch statement. For example, place the following statement before the function containing the switch statement:

    #pragma optimize( "e", off ) // Disables /Oe

and the following statement after the function:

    #pragma optimize( "", on )   // Re-enables /Oe

STATUS

Microsoft has confirmed this to be a problem in the C/C++ compiler for MS-DOS version 8.0. This problem was corrected in the C/C++ compiler for MS-DOS version 8.0c, included with Visual C++ for Windows, version 1.5.


Additional reference words: 1.00 8.00
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CLIss
Keywords : CLIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 1.00
Platform : 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 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.