strange problem in libc: free invalid pointer, but valgrind doesn't show it.
Jonathan Wakely
jwakely@redhat.com
Wed Aug 13 22:49:00 GMT 2014
On 13/08/14 13:11 -0700, Linda A. Walsh wrote:
>Well I see that it is an lvalue in that it points to the values
>that initialize the Left side of the EQ, but once the values have
>been identified, doesn't it function as an rvalue -- by having it's
>value copied to the Lvalue side?
Copying an lvalue does not make it an rvalue.
The terms have nothing whatsoever to do with having values copied
anywhere, an expression is an lvalue or rvalue independent of what you
do with it.
Did you read the link I gave? You only needed to read the
introduction. Just two sentences really:
"An lvalue is an expression that refers to a memory location and
allows us to take the address of that memory location via the &
operator. An rvalue is an expression that is not an lvalue."
http://thbecker.net/articles/rvalue_references/section_01.html
>>>Just above that assignment was this line:
>>>
>>>if (samples_collected() < graphNumSamples())
>>> samples_collected(samples_collected()+1);
>>>samples_collected is *based* on the *size* of samples,
>>>whereas graphnumSamples == the capacity of the vector <samp64>samples.
>
>>
>>Initially size() and capacity() are both zero, so the condition is
>>false and you won't resize the vector. That means samples[0].D is
>>undefined behaviour.
>>
>>Could that be the problem?
>----
> The capacity is read in during program startup as the
>maximum number of samples to store ..... so before the graph stuff or
>routines to read the samples are ever called, that capacity is set.
OK, then samples[0] should be valid. I would still suggest changing it
to samples.at(0) to be sure though.
More information about the Libstdc++
mailing list