[bind10-dev] still some bugs in src/lib/cc

Francis Dupont fdupont at isc.org
Fri Oct 7 09:02:38 UTC 2011


I already signaled some bugs src/lib/cc found by MSVC runtime but
you can can them with g++ debug mode (aka -D_GLIBCXX_DEBUG) too:

./run_unittests --gtest_filter="Element.removeIdentical"
Note: Google Test filter = Element.removeIdentical
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Element
[ RUN      ] Element.removeIdentical
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/debug/safe_iterator.h:222:
    error: attempt to increment a singular iterator.

Objects involved in the operation:
iterator "this" @ 0x0x7fff683424c0 {
type = N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorISt4pairIKSsN5boost10shared_ptrIKN3isc4data7ElementEEEEENSt7__debug3mapISsSA_St4lessISsESaISB_EEEEE (constant iterator);
  state = singular;
  references sequence with type `NSt7__debug3mapISsN5boost10shared_ptrIKN3isc4data7ElementEEESt4lessISsESaISt4pairIKSsS7_EEEE' @ 0x0x7fff683424c0
}
Abort (core dumped)

the problem is a remove in an iterator loop which makes ++ to go
one item after the last one (data.cc):

    for (std::map<std::string, ConstElementPtr>::const_iterator it = m.begin();
         it != m.end() ; ++it) {
        if (b->contains((*it).first)) {
            if (a->get((*it).first)->equals(*b->get((*it).first))) {
                a->remove((*it).first);
            }
        }
    }

my trivial fix is to add a goto after the remove() to rerun the whole
loop but it should be easier to find a better fix.

Regards

Francis Dupont <fdupont at isc.org>



More information about the bind10-dev mailing list