BUG: Unable to Hit Breakpoint on ELSE IF Statement

Last reviewed: May 27, 1997
Article ID: Q117384
The information in this article applies to:
  • The Microsoft C/C++ Compiler (CL.EXE) included with: - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 - Microsoft Visual C++, 32-bit Edition, versions 1.0, 2.0, 2.1, 4.0,

         4.1, 4.2, 5.0
    

SYMPTOMS

If the sample code in the "MORE INFORMATION" section, below, is compiled for debugging (/Zi), the debugger (either CodeView or the Visual Workbench) does not stop at a breakpoint that is placed on the ELSE IF statement.

CAUSE

The compiler does not generate the correct symbolic information for the line of code containing the ELSE IF statement.

RESOLUTION

To work around the problem, place the "else" and "if" statements on separate lines. For example:

   else
      if (i==7)

STATUS

Microsoft has confirmed this to be a bug in the products listed at the top of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To reproduce this problem with the sample code below:

  1. Set a breakpoint on the line with the ELSE IF statement

  2. Press F5(GO) to start debugging the program.

Neither debugger stops running until the program is finished, unless you set a breakpoint on a different line of code.

In CodeView, if you switch into mixed source/assembly mode, you can verify that there is executable code associated with the ELSE IF statement. If a breakpoint is placed on one of the lines of assembly code for the ELSE IF statement and the application is debugged, the code stops running at the breakpoint. With the Visual Workbench debugger, step through the code at the ELSE IF statement to set the breakpoint.

Sample Code

/* Compile options needed: /Zi /Od
*/

   void main(void)
   {
      int i=100;
      if (i==2);
      else if(i==7);  /* cannot stop on this line */
   }


Additional reference words: 6.00 8.00 8.00c 9.00 10.00 10.10 10.20
Keywords : CLIss kbtool vcbuglist400 vcbuglist500
Version : 6.0 6.0a 6.0ax 7.0 1.0 1.5 2.0
Platform : MS-DOS NT WINDOWS


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: May 27, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.