Boost logo

Boost :

Subject: Re: [boost] [chrono] Valgrind complains
From: Roland Bock (rbock_at_[hidden])
Date: 2010-06-23 03:41:52


vicente.botet wrote:
> ----- Original Message -----
> From: "Roland Bock" <rbock_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Wednesday, June 23, 2010 8:05 AM
> Subject: Re: [boost] [chrono] Valgrind complains
>
>
>
>> vicente.botet wrote:
>>
>>> ----- Original Message -----
>>> From: "Roland Bock" <rbock_at_[hidden]>
>>> To: <boost_at_[hidden]>
>>> Sent: Tuesday, June 22, 2010 8:23 PM
>>> Subject: Re: [boost] [chrono] Valgrind complains
>>>
>>>
>>>
>>>
>>>> vicente.botet wrote:
>>>>
>>>>
>>>>> ----- Original Message -----
>>>>> From: "Roland Bock" <rbock_at_[hidden]>
>>>>> To: <boost_at_[hidden]>
>>>>> Sent: Tuesday, June 22, 2010 5:34 PM
>>>>> Subject: Re: [boost] [chrono] Valgrind complains
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>> From: "Roland Bock" <rbock_at_[hidden]>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Valgrind complains about
>>>>>>>>>
>>>>>>>>> Conditional jump or move depends on uninitialised value(s)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> several times for the following line:
>>>>>>>>>
>>>>>>>>> { boost::chrono::stopclock<> stopclock(std::cerr); }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>> Could you check if Valgrind complains with
>>>>>
>>>>> { boost::chrono::stopclock<> stopclock; }
>>>>> or
>>>>> { boost::chrono::stopclock<> stopclock(BOOST_CURRENT_FUNCTION); }
>>>>> or
>>>>> { boost::system::error_code ec;
>>>>> boost::chrono::stopclock<> stopclock(std::cerr, ec); }
>>>>>
>>>>> Thanks,
>>>>> Vicente
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> Hi,
>>>>
>>>> attached are
>>>>
>>>> * the source file containing the original test plus the three
>>>> additional tests suggested by you
>>>> * a file containing compiler warnings
>>>> * the valgrind output (the latter two tests do not produce warnings,
>>>> if I read it correctly)
>>>>
>>>>
>>>> The program was compiled using the following compiler flags (gcc=4.2.4
>>>> on Ubuntu 8.04, 64bit):
>>>>
>>>> -Wall -Wreorder -Wnon-virtual-dtor -Wno-non-template-friend
>>>> -Woverloaded-virtual -Wsign-promo -Wextra -fvisibility=hidden
>>>> -D_GNU_SOURCE -O0 -g
>>>>
>>>>
>>>
>>>
>>> I have seen some places where the parameter system::error_code & ec is not initialized when the function succeed. I have update the code so the variable is initialized. Most of the tests are done with the default system::throws parameter so these errors are not catched. I will try to complete the tests for the no-throw cases soon.
>>>
>>> Roland, please could you download the new version, and check if the Valgrind issue is resolved?
>>>
>>> Thanks in advance,
>>> Vicente
>>>
>>>
>> Hi,
>>
>> the compile warnings are gone, but valgrind stays unhappy.
>>
>> I compiled libboost_chrono.so in debug mode, this time. This way,
>> valgrind's output should be more helpful inside the library's code, see
>> attachment.
>>
>> Regards,
>>
>> Roland
>>
>
> Hi,
>
> it seems there was an old bug on duration operator=()
>
> Could you replace the line
> if (rhs != *this) rep_= rhs.rep_;
>
> by
>
> if (&rhs != this) rep_= rhs.rep_;
>
> or just
>
> //~ if (rhs != &this)
> rep_= rhs.rep_;
>
> Let me know if this solves the issue.
>
> Best,
>
> Vicente
>
>
Hi,

I tried the first option and valgrind is happy now :-)

Thanks and regards,

Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk