Search

VS 2010 Debugger breakpoint skips first iteration of for-loop by DenisStack

Closed
as Fixed Help for as Fixed

3
0
Sign in
to vote
Type: Bug
ID: 713927
Opened: 12/14/2011 4:04:11 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
1
User(s) can reproduce this bug
If you set a breakpoint on the same line as the "for" statement, then run - to - breakpoint, debugger doesn't break until the loop has been iterated once.
This bug also exists in VS 2008.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010

Steps to reproduce

Run the following code in a win32 console application and set a breakpoint at the "for" statement. You will see that "bla" is already 1 at that point - the loop has been iterated once.

int _tmain(int argc, _TCHAR* argv[])
{
    int i = 0;
    int bla = 0;
    for (; i < 1; ++i)
    {
        bla = 1;
    }
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

bla = 1

Expected results

bla = 0
File Attachments
0 attachments
Sign in to post a comment.
Posted by DenisStack on 12/20/2011 at 3:01 AM
Thanks for the fix!
Denis
Posted by Microsoft on 12/19/2011 at 9:50 AM
We have found the root cause and fixed the problem. The fix will be included in our next major Visual Studio release.

The workaround for now is to use /Zi or /Z7 instead of /ZI, which can be set in project's property page, under "C/C++ | General | Debug Information Format".

Thanks a lot for the bug report.


YongKang Zhu
--
VC++ CodeGen and Tools
Posted by MS-Moderator09 [Feedback Moderator] on 12/14/2011 at 11:12 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 12/14/2011 at 4:44 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.