Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/Evaluator/C++    [ Add a report in this area ]  
Report #:  84266   Status: Closed
Wrong value in watch window
Project:  C++Builder Build #:  6.20.3512.25769
Version:    14.0 Submitted By:   Alexey Beloborodov
Report Type:  Basic functionality failure Date Reported:  5/1/2010 7:42:21 AM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   276252
Resolution: Retest (Resolution Comments) Resolved in Build: : 16.0.4251.43429
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Evaluator erroneously treats address of element of std::vector (like &R[10]) as value (not as
pointer).
Steps to Reproduce:
New VCL application, button on form.

#include <vector>
void __fastcall TForm1::Button1Click(TObject *Sender)
{
std::vector<int> R;
for(int i=0; i<50000; ++i) R.push_back(-i);

bool b=false;
for(int i=0; i<50000; ++i)
   if(R[i]!=i) b=true;            // set breakpoint here
if(b) ShowMessage(" ! ");
}

Add watches:

Watch Name
Value
-------------------------------------------
i             16
*R._Myfirst   0, -1, -2, -3, -4, -5, -6, -7, -8, -9
R[i]          -16, -17, -18, -19, -20, -21, -22, -23, -24, -25
&R[i]         -16

Last value is wrong.
-------------------------------------------

In CB2007 it works correctly:

Watch Name
Value
-------------------------------------------
i                16
*R._Myfirst 0, -1, -2, -3, -4, -5, -6, -7, -8, -9
R[i]             -16, -17, -18, -19, -20, -21, -22, -23, -24, -25
&R[i]            :0099F250
       [0]         -16 (0xFFFFFFF0)
-------------------------------------------
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01