[Boost-bugs] [Boost C++ Libraries] #8530: [Coverity] Unused variable thread_handle, uninitialized variable cond_mutex in thread/pthread/thread_data.hpp

Subject: [Boost-bugs] [Boost C++ Libraries] #8530: [Coverity] Unused variable thread_handle, uninitialized variable cond_mutex in thread/pthread/thread_data.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-30 23:25:03


#8530: [Coverity] Unused variable thread_handle, uninitialized variable cond_mutex
in thread/pthread/thread_data.hpp
----------------------------------------+-----------------------------------
 Reporter: Dan Kegel <dank@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
----------------------------------------+-----------------------------------
 This was found in an older release, but is still present in trunk.

 Coverity complains

 134 thread_data_base():
 135 done(false),join_started(false),joined(false),
 136 thread_exit_callbacks(0),
 137 current_cond(0),
 138 notify(),
 139 async_states_()
 140 //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
 141 , interrupt_enabled(true)
 142 , interrupt_requested(false)
 143 //#endif

    (2) Event uninit_member: Non-static class member "thread_handle" is not
 initialized in this constructor nor in any functions
                             that it calls.
    (4) Event uninit_member: Non-static class member "cond_mutex" is not
 initialized in this constructor nor in any functions
                             that it calls.

 Initializing the two fields to zero seems reasonable, and makes coverity
 happy.

 To repeat (assuming you have a coverity license, and bjam in
 $HOME/local/bin):

 PATH=/opt/coverity/cov-analysis-linux64-6.5.1/bin:$HOME/local/bin:$PATH
 cov-configure --gcc
 rm -rf covlog
 mkdir -p covlog
 cov-build --dir covlog bjam t_threads
 cov-analyze --dir covlog
 cov-format-errors --dir covlog
 find covlog -type f | xargs grep cond_mutex.*not.*init
 find covlog -type f | xargs grep thread_handle.*not.*init

 If grep finds anything, you've got the problem.

 The attached patch makes the greps not find anything.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8530>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC