[CoinUtils-tickets] [COIN-OR Common Utilities] #28: umr due to set not defined when first insert

COIN-OR Common Utilities coin-trac at coin-or.org
Sat Apr 7 18:14:44 EDT 2007


#28: umr due to set not defined when first insert
------------------------+---------------------------------------------------
 Reporter:  mgalati     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  major       |   Milestone:          
Component:  component1  |     Version:          
 Keywords:  umr         |  
------------------------+---------------------------------------------------
 set is undefined first pass around

 change
 {{{
 void
 CoinPackedVector::insert( int index, double element )
 {
    const int s = nElements_;
    if (testForDuplicateIndex()) {
       std::set<int>& is = *indexSet("insert", "CoinPackedVector");
       if (! is.insert(index).second)
          throw CoinError("Index already exists", "insert",
 "CoinPackedVector");
    }
 }}}

 to
 {{{
 void
 CoinPackedVector::insert( int index, double element )
 {
 //MVG
    const int s = nElements_;
    if (s > 0 && testForDuplicateIndex()) {
       std::set<int>& is = *indexSet("insert", "CoinPackedVector");
       if (! is.insert(index).second)
          throw CoinError("Index already exists", "insert",
 "CoinPackedVector");
    }
 }}}

 Purify told me this:

 {{{
 [W] UMR: Uninitialized memory read in
 std::_Tree<_Tset_traits<int,less<int>::std,allocator<int>::std,0>::std>::insert(int
 const&) {118 occurrences}
         Reading 1 byte from 0x02d9247c (1 byte at 0x02d9247c
 uninitialized)
         Address 0x02d9247c is 4 bytes into a 28 byte block at 0x02d92478
         Address 0x02d9247c points to a C++ new block in heap 0x003a0000
         Thread ID: 0x14f8
         Error location
 std::_Tree<_Tset_traits<int,less<int>::std,allocator<int>::std,0>::std>::insert(int
 const&) [c:\program files\microsoft visual studio 8\vc\include\xtree.:618]
             CoinPackedVector::insert(int,double)
 [c:\cygwin\home\magala\coin\coin-
 decomp\coinutils\src\coinpackedvector.cpp:193]
                    const int s = nElements_;
                    if (testForDuplicateIndex()) {
                       std::set<int>& is = *indexSet("insert",
 "CoinPackedVector");
              =>       if (! is.insert(index).second)
                      throw CoinError("Index already exists", "insert",
 "CoinPackedVector");
                    }

             MAD_DecompApp::APPcreateModel(double * &,class
 std::map<int,class DecompConstraintSet *,struct std::less<int>,class
 std::allocator<struct std::pair<int const ,class DecompConstraintSet *> >
 > &,class std::map<int,class DecompConstraintSet *,struct
 std::less<int>,class std::allocator<struct std::pair<int const ,class
 DecompConstraintSet *> > > &) [c:\cygwin\home\magala\coin\coin-
 decomp\decomp\examples\mad\mad_decompapp.cpp:160]
                    for(b = 0; b < m_beta; b++){
                       CoinPackedVector row;
                       for(i = 0; i < m_nOrigRows; i++){
              =>          row.insert(xIndex(i,b), 1.0);
                       }
                       modelCoreCl->M->appendRow(row);
                    }
             DecompApp::createModel(void) [c:\cygwin\home\magala\coin\coin-
 decomp\decomp\src\decompapp.cpp:45]
                   //---
                   //--- APP: create the user model A = A' union A''
                   //---
              =>   APPcreateModel(m_model.objCoeff, m_modelCore,
 m_modelRelax);

                   //---
                   //--- TODO: sanity checks that the user gave you all the
 model
             main           [c:\cygwin\home\magala\coin\coin-
 decomp\decomp\examples\mad\mad_alpsmain.cpp:78]
             _tmainCRTStartup
 [f:\rtm\vctools\crt_bld\self_x86\crt\src\crt0.c:318]
             mainCRTStartup
 [f:\rtm\vctools\crt_bld\self_x86\crt\src\crt0.c:186]
 }}}

-- 
Ticket URL: <https://projects.coin-or.org/CoinUtils/ticket/28>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects



More information about the CoinUtils-tickets mailing list