[patch] libstdc++: fix ext/rope::dump() bug

Georeth Chow georeth2010@gmail.com
Mon Jul 25 12:26:00 GMT 2016


Hello, maintainers.

Recently, I tried to figure out how the rope container works by
dumping the content. I found that the implementation of rope::dump()
has a misspell bug which use a static member function as a enum value.

It seems that the original SGI STL implementation doesn't have this bug.

bug trigger code below.

#include <ext/rope>
int main() {
    __gnu_cxx::crope r(100, 'x');
    r.dump();
    return 0;
}

patch is attached.

Thanks,
Georeth
-------------- next part --------------
diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index 4316af7..93bd152 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1117,7 +1117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  printf("NULL\n");
 	  return;
 	}
-      if (_S_concat == __r->_M_tag)
+      if (__detail::_S_concat == __r->_M_tag)
 	{
 	  _RopeConcatenation* __c = (_RopeConcatenation*)__r;
 	  _RopeRep* __left = __c->_M_left;


More information about the Libstdc++ mailing list