public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66451] Array not fully destructed if element destructor throws exception
[not found] <bug-66451-4@http.gcc.gnu.org/bugzilla/>
@ 2015-06-08 9:03 ` redi at gcc dot gnu.org
2022-01-06 21:47 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-06-08 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66451
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-06-08
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Dodd from comment #0)
> If an array element throws during destruction, undestructed elements in that
> array are not destructed. Other local variables are destructed. Clang calls
> destructors on all automatic objects, regardless whether in or out of an
> array.
Not always ;-) https://llvm.org/bugs/show_bug.cgi?id=22877
This is probably related to PR66139
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66451] Array not fully destructed if element destructor throws exception
[not found] <bug-66451-4@http.gcc.gnu.org/bugzilla/>
2015-06-08 9:03 ` [Bug c++/66451] Array not fully destructed if element destructor throws exception redi at gcc dot gnu.org
@ 2022-01-06 21:47 ` jason at gcc dot gnu.org
2022-01-07 0:25 ` cvs-commit at gcc dot gnu.org
2022-01-07 0:31 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-06 21:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66451
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66451] Array not fully destructed if element destructor throws exception
[not found] <bug-66451-4@http.gcc.gnu.org/bugzilla/>
2015-06-08 9:03 ` [Bug c++/66451] Array not fully destructed if element destructor throws exception redi at gcc dot gnu.org
2022-01-06 21:47 ` jason at gcc dot gnu.org
@ 2022-01-07 0:25 ` cvs-commit at gcc dot gnu.org
2022-01-07 0:31 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-07 0:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66451
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:2fbc45486e13facfeb05bd6ddf70ff9973a30a3c
commit r12-6331-g2fbc45486e13facfeb05bd6ddf70ff9973a30a3c
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jan 5 09:49:37 2022 -0500
c++: keep destroying array after one dtor throws [PR66451]
When we're cleaning up an array, if one destructor throws, we should still
try to clean up the rest of the array. We can use TRY_CATCH_EXPR for this,
instead of a TARGET_EXPR like my other recent patches, because a destructor
call can't involve any temporaries that need to live longer.
I thought about only doing this when we call build_vec_delete_1 from
build_vec_init, but it seems appropriate for delete-expressions as well;
we've said that the array's lifetime is over, it makes sense to keep trying
to destroy it. The standard isn't clear, but clang seems to agree with me.
PR c++/66451
gcc/cp/ChangeLog:
* init.c (build_vec_delete_1): Handle throwing dtor.
(build_vec_init): Tell it we're in a cleanup already.
gcc/testsuite/ChangeLog:
* g++.dg/eh/array3.C: New test.
* g++.dg/eh/array1.C: Mark destructor as throw().
* g++.dg/ipa/devirt-40.C: Likewise.
* g++.dg/warn/pr83054.C: Likewise.
* g++.dg/eh/delete1.C: Shorten array to one element.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/66451] Array not fully destructed if element destructor throws exception
[not found] <bug-66451-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2022-01-07 0:25 ` cvs-commit at gcc dot gnu.org
@ 2022-01-07 0:31 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-07 0:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66451
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |12.0
Status|ASSIGNED |RESOLVED
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-07 0:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-66451-4@http.gcc.gnu.org/bugzilla/>
2015-06-08 9:03 ` [Bug c++/66451] Array not fully destructed if element destructor throws exception redi at gcc dot gnu.org
2022-01-06 21:47 ` jason at gcc dot gnu.org
2022-01-07 0:25 ` cvs-commit at gcc dot gnu.org
2022-01-07 0:31 ` jason 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).