This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Rope iterators: don't retain pointers when copied


Rope iterators sometimes contain pointers to an internal buffer
inside the iterator itself.  When such an iterator is copied, the
copy incorrectly retains pointers to the original.

This patch takes the simple approach of not copying the cached
information when the internal buffer is being used, instead
requiring it to be recomputed when the copied iterator is
dereferenced.  An alternative would be to adjust the pointers so
they refer to the buffer in the copy.

I tested on Linux x64 with "<srcdir>/configure", "make bootstrap",
and "make -k check", three times: (1) with no changes (as a
baseline), (2) with only the new test (to make sure it fails), and
(3) with the new test and bug fix (to make sure the test passes and
nothing else changes).


	* include/ext/rope (_Rope_iterator_base(const _Rope_iterator_base&))
	(_Rope_const_iterator::operator=(const _Rope_const_iterator&))
	(_Rope_iterator::operator=(const _Rope_iterator&)):
	Copied/assigned rope iterators don't retain pointers to the
	iterator they were copied/assigned from.
	* testsuite/ext/rope/7.cc: New.

Attachment: rope-iterator-copy-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]