This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] fix singular iterator dereference in libstdc++ testcase 23_containers/list_modifiers.cc
- From: Doug Gregor <dgregor at apple dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Jun 2003 15:21:49 -0700
- Subject: [PATCH] fix singular iterator dereference in libstdc++ testcase 23_containers/list_modifiers.cc
In the testcase 23_containers/list_modifiers.cc, the function test01()
contains this block of code:
list0101.pop_back(); // list should be [2 1]
VERIFY(list0101.size() == 2);
VERIFY(T::dtorCount() == 1);
VERIFY(i->id() == 1);
VERIFY(j->id() == 1); // INVALID
VERIFY(k->id() == 1);
Prior to the pop_back() call, the list is [2 1 3] and the iterators i
and k, along with reverse_iterator j, point to the 1. However, the
actual iterator that j stores (in j.current) points to the 3, which is
invalidated by the pop_back() call, and therefore should not be
dereferenced at the line marked INVALID. The same problem occurs again
in the next block (j.current is still singular).
Note that the problem does not show up as a failure in normal test
runs, presumably because the old node is still accessible in memory due
to the pooling allocator.
Patch & changelog entry attached.
Doug
Attachment:
list_modifiers_invalid.ChangeLog
Description: Binary data
Attachment:
list_modifiers_invalid.patch
Description: Binary data