You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Farid Zaripov (JIRA)" <ji...@apache.org> on 2007/02/01 11:30:05 UTC
[jira] Created: (STDCXX-331) std::list::insert() method do not
satisfy strong exception safety requirements
std::list::insert() method do not satisfy strong exception safety requirements
------------------------------------------------------------------------------
Key: STDCXX-331
URL: https://issues.apache.org/jira/browse/STDCXX-331
Project: C++ Standard Library
Issue Type: Bug
Components: 23. Containers
Affects Versions: 4.1.3
Environment: All
Reporter: Farid Zaripov
The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
Details are here:
http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
test.cpp:
------------------------------
#include <list>
#include <cassert>
static int throw_inx = -1;
class ListItem
{
public:
static int count_;
void test ()
{
if (throw_inx == count_)
throw count_;
++count_;
}
ListItem () { test (); }
ListItem (const ListItem&) { test (); }
~ListItem () { --count_; }
};
int ListItem::count_ = 0;
int main (int argc, char* argv[])
{
typedef std::list<ListItem> List;
ListItem items [20];
List lst (1);
bool thrown = false;
throw_inx = 10;
List::iterator it = lst.begin ();
ListItem & ref = *it;
try {
ListItem::count_ = 0;
lst.insert (it, 20, items [0]);
} catch (...) {
thrown = true;
}
assert (thrown);
assert (it == lst.begin ());
assert (&ref == &*lst.begin ());
assert (1 == lst.size ());
assert (0 == ListItem::count_);
try {
ListItem::count_ = 0;
lst.insert (it, items, items + 20);
} catch (...) {
thrown = true;
}
assert (thrown);
assert (it == lst.begin ());
assert (&ref == &*lst.begin ());
assert (1 == lst.size ());
assert (0 == ListItem::count_);
return 0;
}
The test output:
------------------------------
test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Reopened: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov reopened STDCXX-331:
----------------------------------
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (STDCXX-331) std::list::insert() method do not
satisfy strong exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov resolved STDCXX-331.
----------------------------------
Resolution: Fixed
Fix Version/s: 4.2
Fixed thus: http://svn.apache.org/viewvc?view=rev&rev=507971
> std::list::insert() method do not satisfy strong exception safety requirements
> ------------------------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12501874 ]
Farid Zaripov commented on STDCXX-331:
--------------------------------------
The regression test added thus: http://svn.apache.org/viewvc?view=rev&rev=544782
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Sebor updated STDCXX-331:
--------------------------------
Summary: std::list::insert() violates strong exception safety requirements (was: std::list::insert() method do not satisfy strong exception safety requirements)
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Sebor reassigned STDCXX-331:
-----------------------------------
Assignee: Farid Zaripov
Farid, please close this after you've added the test case to our regression test suite.
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assigned To: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov updated STDCXX-331:
---------------------------------
Comment: was deleted
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov closed STDCXX-331.
--------------------------------
The test suite already have the test cases to detect this bug. Actually the bug was found after running the 23.list.insert test.
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (STDCXX-331) std::list::insert() violates strong
exception safety requirements
Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov closed STDCXX-331.
--------------------------------
Resolution: Fixed
> std::list::insert() violates strong exception safety requirements
> -----------------------------------------------------------------
>
> Key: STDCXX-331
> URL: https://issues.apache.org/jira/browse/STDCXX-331
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 23. Containers
> Affects Versions: 4.1.3
> Environment: All
> Reporter: Farid Zaripov
> Assignee: Farid Zaripov
> Fix For: 4.2
>
>
> The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1).
> Details are here:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e
> test.cpp:
> ------------------------------
> #include <list>
> #include <cassert>
> static int throw_inx = -1;
> class ListItem
> {
> public:
> static int count_;
> void test ()
> {
> if (throw_inx == count_)
> throw count_;
> ++count_;
> }
> ListItem () { test (); }
> ListItem (const ListItem&) { test (); }
> ~ListItem () { --count_; }
> };
> int ListItem::count_ = 0;
> int main (int argc, char* argv[])
> {
> typedef std::list<ListItem> List;
> ListItem items [20];
> List lst (1);
> bool thrown = false;
> throw_inx = 10;
> List::iterator it = lst.begin ();
> ListItem & ref = *it;
> try {
> ListItem::count_ = 0;
> lst.insert (it, 20, items [0]);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> try {
> ListItem::count_ = 0;
> lst.insert (it, items, items + 20);
> } catch (...) {
> thrown = true;
> }
> assert (thrown);
> assert (it == lst.begin ());
> assert (&ref == &*lst.begin ());
> assert (1 == lst.size ());
> assert (0 == ListItem::count_);
> return 0;
> }
> The test output:
> ------------------------------
> test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed.
> Aborted.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.