
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.