[Ipopt-tickets] [Ipopt] #13: list iterator not decrementable

Ipopt coin-trac at coin-or.org
Sun Jun 18 22:54:18 EDT 2006


#13: list iterator not decrementable
------------------------------+---------------------------------------------
Reporter:  sylvainmiossec     |       Owner:  ipopt-team
    Type:  defect             |      Status:  new       
Priority:  normal             |   Component:  Ipopt     
 Version:  3.0 - C++ Version  |    Severity:  normal    
Keywords:                     |  
------------------------------+---------------------------------------------
 When using IPOPT 3.1.0 compiled with MS Visual Studio 2005 Express
 Edition, I get an error for a "list iterator not decrementable" (someone
 else also get this problem in the coin-ipopt mailing list). After a few
 investigation, I found that the error happen in the class IpFilter in the
 function Filter::AddEntry. It happen sometimes that the iterator is
 decremented outside of its range, which is protected with the 2005 version
 of MS visual C++. So I modified the following piece of code in
 IpFilter.cpp:

     for (iter = filter_list_.begin(); iter != filter_list_.end();
          iter++) {
       if ((*iter)->Dominated(vals)) {
         std::list<FilterEntry*>::iterator iter_to_remove = iter;
         iter--;
         FilterEntry* entry_to_remove = *iter_to_remove;
         filter_list_.erase(iter_to_remove);
         delete entry_to_remove;
       }
     }

 with

     iter = filter_list_.begin();
     while ( iter != filter_list_.end() ) {
       if ((*iter)->Dominated(vals)) {
                 std::list<FilterEntry*>::iterator iter_to_remove = iter;
                 iter++;
                 FilterEntry* entry_to_remove = *iter_to_remove;
                 filter_list_.erase(iter_to_remove);
                 delete entry_to_remove;
           } else {
             iter++;
           }
     }

 Now it seems to work well. Since it is the first time I use this system of
 bug tracking, and don't know how to correct this myself, I just let you
 know and correct it yourself.

-- 
Ticket URL: <https://projects.coin-or.org/Ipopt/ticket/13>
Ipopt <http://www.coin-or.org>
Ipopt Tickets


More information about the Ipopt-tickets mailing list