public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception
@ 2012-12-09 23:53 joedoefawnbuck at googlemail dot com
2012-12-10 0:56 ` [Bug c++/55635] " redi at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: joedoefawnbuck at googlemail dot com @ 2012-12-09 23:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
Bug #: 55635
Summary: Deallocation function ("operator delete") not called
when destructor throws exception
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: joedoefawnbuck@googlemail.com
According to C++11, 5.3.5/7, the deallocation function of a dynamically
allocated object must be called upon a `delete` expression regardless of
whether the destructor exits with an exception or not.
However, when I run the following code through valgrind, it says that I have
one still-reachable block:
struct Foo { ~Foo() { throw 0; } };
int main()
{
auto p = new Foo;
try { delete p; }
catch (...) { }
}
Am I reading the standard right that the memory should be deallocated
regardless?
(SO discussion: http://stackoverflow.com/q/13792981/596781)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
@ 2012-12-10 0:56 ` redi at gcc dot gnu.org
2012-12-10 9:09 ` joedoefawnbuck at googlemail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-12-10 0:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-12-10
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-10 00:56:28 UTC ---
Your destructor calls terminate() according to C++11, it should be declared
noexcept(false) to demonstrate the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
2012-12-10 0:56 ` [Bug c++/55635] " redi at gcc dot gnu.org
@ 2012-12-10 9:09 ` joedoefawnbuck at googlemail dot com
2012-12-10 9:10 ` joedoefawnbuck at googlemail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: joedoefawnbuck at googlemail dot com @ 2012-12-10 9:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
--- Comment #2 from Kerrek SB <joedoefawnbuck at googlemail dot com> 2012-12-10 09:08:46 UTC ---
Interesting, thank you!
The bug remains, however, both with -std=c++11 and noexcept(false), and with
-std=c++98 and throw(int).
Also, with noexcept(false) GCC will *not* call terminate()...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
2012-12-10 0:56 ` [Bug c++/55635] " redi at gcc dot gnu.org
2012-12-10 9:09 ` joedoefawnbuck at googlemail dot com
@ 2012-12-10 9:10 ` joedoefawnbuck at googlemail dot com
2012-12-10 10:37 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: joedoefawnbuck at googlemail dot com @ 2012-12-10 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
--- Comment #3 from Kerrek SB <joedoefawnbuck at googlemail dot com> 2012-12-10 09:10:25 UTC ---
(Sorry, I meant "*without* noexcept(false)".)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
` (2 preceding siblings ...)
2012-12-10 9:10 ` joedoefawnbuck at googlemail dot com
@ 2012-12-10 10:37 ` redi at gcc dot gnu.org
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2012-12-10 10:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-10 10:37:29 UTC ---
G++ 4.7 doesn't call terminate because it doesn't implement
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1123, but trunk
does.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
` (3 preceding siblings ...)
2012-12-10 10:37 ` redi at gcc dot gnu.org
@ 2021-12-10 11:36 ` pinskia at gcc dot gnu.org
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10 11:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Target Milestone|--- |7.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/55635] Deallocation function ("operator delete") not called when destructor throws exception
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
` (4 preceding siblings ...)
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
@ 2021-12-10 11:36 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10 11:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55635
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |programmerjake at gmail dot com
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 70447 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-10 11:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-09 23:53 [Bug c++/55635] New: Deallocation function ("operator delete") not called when destructor throws exception joedoefawnbuck at googlemail dot com
2012-12-10 0:56 ` [Bug c++/55635] " redi at gcc dot gnu.org
2012-12-10 9:09 ` joedoefawnbuck at googlemail dot com
2012-12-10 9:10 ` joedoefawnbuck at googlemail dot com
2012-12-10 10:37 ` redi at gcc dot gnu.org
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
2021-12-10 11:36 ` pinskia at gcc dot gnu.org
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).