
Hi Vicente, Valgrind complains about Conditional jump or move depends on uninitialised value(s) several times for the following line: { boost::chrono::stopclock<> stopclock(std::cerr); } Regards, Roland

----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Monday, June 21, 2010 9:24 AM Subject: [boost] [chrono] Valgrind complains
Hi Vicente,
Valgrind complains about
Conditional jump or move depends on uninitialised value(s)
several times for the following line:
{ boost::chrono::stopclock<> stopclock(std::cerr); }
Hi, Sorry, I don't find this line. Please could you tell me where do you find this line on the code? Best, Vicente

vicente.botet wrote:
From: "Roland Bock" <rbock@eudoxos.de>
Valgrind complains about
Conditional jump or move depends on uninitialised value(s)
several times for the following line:
{ boost::chrono::stopclock<> stopclock(std::cerr); }
Sorry, I don't find this line. Please could you tell me where do you find this line on the code?
I presume he meant that if he puts such a line in his app, Valgrind complains. _____ Rob Stewart robert.stewart@sig.com Software Engineer, Core Software using std::disclaimer; Susquehanna International Group, LLP http://www.sig.com IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Stewart, Robert wrote:
vicente.botet wrote:
From: "Roland Bock" <rbock@eudoxos.de>
Valgrind complains about
Conditional jump or move depends on uninitialised value(s)
several times for the following line:
{ boost::chrono::stopclock<> stopclock(std::cerr); }
Sorry, I don't find this line. Please could you tell me where do you find this line on the code?
I presume he meant that if he puts such a line in his app, Valgrind complains.
Right. That's sample code :-) Regards, Roland

----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
Stewart, Robert wrote:
vicente.botet wrote:
From: "Roland Bock" <rbock@eudoxos.de>
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

vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
Stewart, Robert wrote:
vicente.botet wrote:
From: "Roland Bock" <rbock@eudoxos.de>
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 Regards, Roland Scanning dependencies of target Chrono [ 66%] Building CXX object src/CMakeFiles/Chrono.dir/Chrono.o /home/rbock/metafeed_DEBUG/binaries/boost/1.43/include/boost/chrono/scoped_suspend.hpp: In instantiation of ‘boost::chrono::scoped_suspend<Clock>::scoped_suspend(boost::system::error_code&) [with Clock = boost::chrono::process_cpu_clock]’: /home/rbock/metafeed_DEBUG/binaries/boost/1.43/include/boost/chrono/stopwatch_reporter.hpp:148: instantiated from ‘void boost::chrono::basic_stopwatch_reporter<Stopwatch, Formatter>::report(boost::system::error_code&) [with Stopwatch = boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, Formatter = boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >]’ /home/rbock/metafeed_DEBUG/binaries/boost/1.43/include/boost/chrono/stopwatch_reporter.hpp:120: instantiated from ‘boost::chrono::basic_stopwatch_reporter<Stopwatch, Formatter>::~basic_stopwatch_reporter() [with Stopwatch = boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, Formatter = boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >]’ /home/rbock/metafeed_DEBUG/binaries/boost/1.43/include/boost/chrono/stopclock.hpp:47: instantiated from here /home/rbock/metafeed_DEBUG/binaries/boost/1.43/include/boost/chrono/scoped_suspend.hpp:25: warning: unused parameter ‘ec’ Linking CXX executable Chrono [100%] Built target Chrono ==7565== Memcheck, a memory error detector. ==7565== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==7565== Using LibVEX rev 1804, a library for dynamic binary translation. ==7565== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==7565== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework. ==7565== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==7565== For more details, rerun with: -v ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x503550D: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x4029B6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:152) ==7565== by 0x402B23: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==7565== by 0x403272: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:157) ==7565== by 0x40331A: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==7565== by 0x4033AA: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==7565== by 0x4033C2: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==7565== by 0x401841: main (Chrono.cpp:8) ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x5035527: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x4029B6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:152) ==7565== by 0x402B23: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==7565== by 0x403272: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:157) ==7565== by 0x40331A: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==7565== by 0x4033AA: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==7565== by 0x4033C2: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==7565== by 0x401841: main (Chrono.cpp:8) ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x5035541: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x4029B6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:152) ==7565== by 0x402B23: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==7565== by 0x403272: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:157) ==7565== by 0x40331A: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==7565== by 0x4033AA: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==7565== by 0x4033C2: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==7565== by 0x401841: main (Chrono.cpp:8) real 0.030s, cpu 0.020s (66.7%), user 0.020s, system 0.000s ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x503550D: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x402684: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==7565== by 0x402748: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==7565== by 0x4027B0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==7565== by 0x402856: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==7565== by 0x402876: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==7565== by 0x401852: main (Chrono.cpp:10) ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x5035527: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x402684: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==7565== by 0x402748: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==7565== by 0x4027B0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==7565== by 0x402856: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==7565== by 0x402876: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==7565== by 0x401852: main (Chrono.cpp:10) ==7565== ==7565== Conditional jump or move depends on uninitialised value(s) ==7565== at 0x5035541: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x50375EF: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (in /home/rbock/metafeed/sources/trunk/binaries/boost/1.43/lib/libboost_chrono.so.1.43.0) ==7565== by 0x402684: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==7565== by 0x402748: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==7565== by 0x4027B0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==7565== by 0x402856: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==7565== by 0x402876: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==7565== by 0x401852: main (Chrono.cpp:10) real 0.010s, cpu 0.000s (0.0%), user 0.000s, system 0.000s int main()real 0.000s, cpu 0.000s (0.0%), user 0.000s, system 0.000s ==7565== ==7565== ERROR SUMMARY: 21 errors from 6 contexts (suppressed: 8 from 1) ==7565== malloc/free: in use at exit: 0 bytes in 0 blocks. ==7565== malloc/free: 4 allocs, 4 frees, 248 bytes allocated. ==7565== For counts of detected errors, rerun with: -v ==7565== All heap blocks were freed -- no leaks are possible.

----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 8:23 PM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
From: "Roland Bock" <rbock@eudoxos.de>
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

vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 8:23 PM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
From: "Roland Bock" <rbock@eudoxos.de>
> 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 ==11617== Memcheck, a memory error detector. ==11617== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==11617== Using LibVEX rev 1804, a library for dynamic binary translation. ==11617== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==11617== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework. ==11617== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==11617== For more details, rerun with: -v ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503AD3B: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:59) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4028F6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:156) ==11617== by 0x402A63: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==11617== by 0x403140: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:152) ==11617== by 0x4031A4: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==11617== by 0x403234: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==11617== by 0x40324C: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==11617== by 0x401741: main (Chrono.cpp:8) ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503AD9B: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:60) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4028F6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:156) ==11617== by 0x402A63: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==11617== by 0x403140: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:152) ==11617== by 0x4031A4: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==11617== by 0x403234: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==11617== by 0x40324C: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==11617== by 0x401741: main (Chrono.cpp:8) ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503ADFB: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:61) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4028F6: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::elapsed(boost::system::error_code&) (stopwatch.hpp:156) ==11617== by 0x402A63: void boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> >::show_time<boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > > >(boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >&, char const*, int, std::ostream&, boost::system::error_code&) (time_formatter.hpp:74) ==11617== by 0x403140: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::report(boost::system::error_code&) (stopwatch_reporter.hpp:152) ==11617== by 0x4031A4: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopwatch_reporter() (stopwatch_reporter.hpp:120) ==11617== by 0x403234: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~basic_stopclock() (stopclock.hpp:47) ==11617== by 0x40324C: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::~stopclock() (stopclock.hpp:116) ==11617== by 0x401741: main (Chrono.cpp:8) real 0.030s, cpu 0.030s (100.0%), user 0.030s, system 0.000s ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503AD3B: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:59) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4025BA: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==11617== by 0x402688: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==11617== by 0x4026F0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==11617== by 0x402796: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==11617== by 0x4027B6: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==11617== by 0x401752: main (Chrono.cpp:10) ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503AD9B: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:60) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4025BA: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==11617== by 0x402688: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==11617== by 0x4026F0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==11617== by 0x402796: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==11617== by 0x4027B6: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==11617== by 0x401752: main (Chrono.cpp:10) ==11617== ==11617== Conditional jump or move depends on uninitialised value(s) ==11617== at 0x503B0B3: boost::chrono::duration<long, boost::ratio<1l, 1000000000l> >::operator=(boost::chrono::duration<long, boost::ratio<1l, 1000000000l> > const&) (chrono.hpp:538) ==11617== by 0x503ADFB: boost::chrono::process_clock::now(boost::chrono::process_clock::durations&, boost::system::error_code&) (process_clock.cpp:61) ==11617== by 0x503D5B4: boost::chrono::process_cpu_clock::now(boost::system::error_code&) (process_cpu_clocks.cpp:43) ==11617== by 0x4025BA: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::start(boost::system::error_code&) (stopwatch.hpp:80) ==11617== by 0x402688: boost::chrono::stopwatch<boost::chrono::process_cpu_clock>::stopwatch(boost::system::error_code&) (stopwatch.hpp:70) ==11617== by 0x4026F0: boost::chrono::basic_stopwatch_reporter<boost::chrono::stopwatch<boost::chrono::process_cpu_clock>, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopwatch_reporter(boost::system::error_code&) (stopwatch_reporter.hpp:79) ==11617== by 0x402796: boost::chrono::basic_stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::basic_stopclock(boost::system::error_code&) (stopclock.hpp:58) ==11617== by 0x4027B6: boost::chrono::stopclock<boost::chrono::process_cpu_clock, boost::chrono::basic_time_formatter<char, std::char_traits<char>, std::allocator<char> > >::stopclock(boost::system::error_code&) (stopclock.hpp:127) ==11617== by 0x401752: main (Chrono.cpp:10) real 0.010s, cpu 0.010s (100.0%), user 0.010s, system 0.000s int main()real 0.000s, cpu 0.000s (0.0%), user 0.000s, system 0.000s ==11617== ==11617== ERROR SUMMARY: 21 errors from 6 contexts (suppressed: 8 from 1) ==11617== malloc/free: in use at exit: 0 bytes in 0 blocks. ==11617== malloc/free: 4 allocs, 4 frees, 248 bytes allocated. ==11617== For counts of detected errors, rerun with: -v ==11617== All heap blocks were freed -- no leaks are possible.

----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Wednesday, June 23, 2010 8:05 AM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 8:23 PM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
> From: "Roland Bock" <rbock@eudoxos.de> > > > >> 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

vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Wednesday, June 23, 2010 8:05 AM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 8:23 PM Subject: Re: [boost] [chrono] Valgrind complains
vicente.botet wrote:
----- Original Message ----- From: "Roland Bock" <rbock@eudoxos.de> To: <boost@lists.boost.org> Sent: Tuesday, June 22, 2010 5:34 PM Subject: Re: [boost] [chrono] Valgrind complains
>> From: "Roland Bock" <rbock@eudoxos.de> >> >> >> >> >>> 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

Roland Bock-2 wrote:
vicente.botet wrote:
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.
Hi,
I tried the first option and valgrind is happy now :-)
Thanks and regards,
Roland
Thank you very much for reporting this Chrono Valgrind issue. Vicente -- View this message in context: http://old.nabble.com/-chrono--Valgrind-complains-tp28945740p28969647.html Sent from the Boost - Dev mailing list archive at Nabble.com.

Roland Bock wrote:
Stewart, Robert wrote:
vicente.botet wrote:
From: "Roland Bock" <rbock@eudoxos.de>
Valgrind complains about
Conditional jump or move depends on uninitialised value(s)
several times for the following line:
{ boost::chrono::stopclock<> stopclock(std::cerr); }
Sorry, I don't find this line. Please could you tell me where do you find this line on the code?
I presume he meant that if he puts such a line in his app, Valgrind complains.
Right. That's sample code :-)
Then, you should provide the exact warning message from valgrind, including the backtrace. - Volodya
participants (5)
-
Roland Bock
-
Stewart, Robert
-
Vicente Botet Escriba
-
vicente.botet
-
Vladimir Prus