public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown
@ 2005-12-06 21:29 lennox at cs dot columbia dot edu
2005-12-06 21:30 ` [Bug libstdc++/25288] " lennox at cs dot columbia dot edu
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: lennox at cs dot columbia dot edu @ 2005-12-06 21:29 UTC (permalink / raw)
To: gcc-bugs
According to section 23.2.2.3 [lib.list.modifiers] of the C++ specification,
for all the insert member functions of std::list, "If an exception is thrown
there are no effects."
However, this doesn't appear to be the case for libstdc++. It's possible for
an exception to be thrown out of an insert() function (e.g. bad_alloc from an
allocator) and still have the list change.
$ g++40 -v -g -O2 -Wall debug_allocate.cpp -o debug_allocate
Using built-in specs.
Target: i386-portbld-freebsd5.4
Configured with: ./..//gcc-4.0-20050929/configure --disable-nls
--with-system-zlib --with-libiconv-prefix=/usr/local --program-suffix=40
--libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3
--with-gxx-include-dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++/
--with-gmp=/usr/local --disable-shared --prefix=/usr/local
i386-portbld-freebsd5.4
Thread model: posix
gcc version 4.0.3 20050928 (prerelease) [FreeBSD]
/usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.3/cc1plus -quiet -v
debug_allocate.cpp -quiet -dumpbase debug_allocate.cpp -auxbase debug_allocate
-g -O2 -Wall -version -o /var/tmp//cc9cvkJd.s
ignoring nonexistent directory
"/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/../../../../i386-portbld-freebsd5.4/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++/
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++//i386-portbld-freebsd5.4
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/include/c++//backward
/usr/local/include
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/include
/usr/include
End of search list.
GNU C++ version 4.0.3 20050928 (prerelease) [FreeBSD] (i386-portbld-freebsd5.4)
compiled by GNU C version 4.0.3 20050928 (prerelease) [FreeBSD].
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129460
as -o /var/tmp//ccljCm8j.o /var/tmp//cc9cvkJd.s
/usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.0.3/collect2 -V
-dynamic-linker /usr/libexec/ld-elf.so.1 -o debug_allocate /usr/lib/crt1.o
/usr/lib/crti.o
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/crtbegin.o
-L/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3
-L/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/../../..
/var/tmp//ccljCm8j.o -lstdc++ -lm -lgcc -lc -lgcc
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.0.3/gcc/i386-portbld-freebsd5.4/4.0.3/crtend.o
/usr/lib/crtn.o
GNU ld version 2.15 [FreeBSD] 2004-05-23
Supported emulations:
elf_i386_fbsd
$ ./debug_allocate
Caught exception: St9bad_alloc
List size: 5
(I'll attach the test programs immediately after submitting the bug.)
--
Summary: std::list insert members should have no effects if an
exception is thrown
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lennox at cs dot columbia dot edu
GCC build triplet: i386-portbld-freebsd5.4
GCC host triplet: i386-portbld-freebsd5.4
GCC target triplet: i386-portbld-freebsd5.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
@ 2005-12-06 21:30 ` lennox at cs dot columbia dot edu
2005-12-06 21:31 ` lennox at cs dot columbia dot edu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: lennox at cs dot columbia dot edu @ 2005-12-06 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from lennox at cs dot columbia dot edu 2005-12-06 21:30 -------
Created an attachment (id=10426)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10426&action=view)
C source file, constructing a list with a custom debug allocator.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
2005-12-06 21:30 ` [Bug libstdc++/25288] " lennox at cs dot columbia dot edu
@ 2005-12-06 21:31 ` lennox at cs dot columbia dot edu
2005-12-06 22:36 ` pcarlini at suse dot de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: lennox at cs dot columbia dot edu @ 2005-12-06 21:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from lennox at cs dot columbia dot edu 2005-12-06 21:31 -------
Created an attachment (id=10427)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10427&action=view)
Custom debug allocator, based on libstdc++'s malloc_allocator.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
2005-12-06 21:30 ` [Bug libstdc++/25288] " lennox at cs dot columbia dot edu
2005-12-06 21:31 ` lennox at cs dot columbia dot edu
@ 2005-12-06 22:36 ` pcarlini at suse dot de
2005-12-09 18:25 ` paolo at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-12-06 22:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pcarlini at suse dot de 2005-12-06 22:36 -------
Ouch! Luckily seems not too difficult to fix, consistently with other similar
situations in the library. Thanks for your report.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-12-06 22:36:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
` (2 preceding siblings ...)
2005-12-06 22:36 ` pcarlini at suse dot de
@ 2005-12-09 18:25 ` paolo at gcc dot gnu dot org
2005-12-30 9:39 ` pcarlini at suse dot de
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu dot org @ 2005-12-09 18:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo at gcc dot gnu dot org 2005-12-09 18:25 -------
Subject: Bug 25288
Author: paolo
Date: Fri Dec 9 18:24:53 2005
New Revision: 108313
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108313
Log:
2005-12-09 Paolo Carlini <pcarlini@suse.de>
Howard Hinnant <hhinnant@apple.com>
PR libstdc++/25288
* include/bits/stl_list.h (list<>::_M_insert_dispatch, _M_fill_insert):
Remove.
(_M_initialize_dispatch, _M_fill_initialize): Add.
(list(size_type, const value_type&, const allocator_type&),
list(const list&), list(_InputIterator, _InputIterator,
const allocator_type&): Use the latter.
(insert(iterator, size_type, const value_type&), insert(iterator,
_InputIterator, _InputIterator)): Use construction & splice.
* testsuite/23_containers/list/modifiers/insert/25288.cc: New.
* testsuite/testsuite_allocator.h (class throw_allocator): Add.
* include/bits/stl_list.h (list<>::insert, erase): Fix wrong comments.
Added:
trunk/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/
trunk/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_list.h
trunk/libstdc++-v3/testsuite/testsuite_allocator.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
` (3 preceding siblings ...)
2005-12-09 18:25 ` paolo at gcc dot gnu dot org
@ 2005-12-30 9:39 ` pcarlini at suse dot de
2007-05-21 8:23 ` pcarlini at suse dot de
2007-05-21 14:01 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2005-12-30 9:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pcarlini at suse dot de 2005-12-30 09:39 -------
Fixed.
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
` (4 preceding siblings ...)
2005-12-30 9:39 ` pcarlini at suse dot de
@ 2007-05-21 8:23 ` pcarlini at suse dot de
2007-05-21 14:01 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2007-05-21 8:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pcarlini at suse dot de 2007-05-21 09:22 -------
*** Bug 32017 has been marked as a duplicate of this bug. ***
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dave at boost-consulting dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/25288] std::list insert members should have no effects if an exception is thrown
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
` (5 preceding siblings ...)
2007-05-21 8:23 ` pcarlini at suse dot de
@ 2007-05-21 14:01 ` pcarlini at suse dot de
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2007-05-21 14:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pcarlini at suse dot de 2007-05-21 15:00 -------
*** Bug 32017 has been marked as a duplicate of this bug. ***
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25288
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-05-21 14:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-06 21:29 [Bug libstdc++/25288] New: std::list insert members should have no effects if an exception is thrown lennox at cs dot columbia dot edu
2005-12-06 21:30 ` [Bug libstdc++/25288] " lennox at cs dot columbia dot edu
2005-12-06 21:31 ` lennox at cs dot columbia dot edu
2005-12-06 22:36 ` pcarlini at suse dot de
2005-12-09 18:25 ` paolo at gcc dot gnu dot org
2005-12-30 9:39 ` pcarlini at suse dot de
2007-05-21 8:23 ` pcarlini at suse dot de
2007-05-21 14:01 ` pcarlini at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).