public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14724] New: Destructor not called on backwards goto past initialization
@ 2004-03-24 22:33 gson at gson dot org
2004-03-24 23:00 ` [Bug c++/14724] " bangerth at dealii dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: gson at gson dot org @ 2004-03-24 22:33 UTC (permalink / raw)
To: gcc-bugs
When the following program is compiled with g++ 3.3.2 and executed, it
will invoke the constructor of the object "v" 10 times in a row with
no intervening calls to the destructor, as evidenced by it printing
"ctor" 10 times but "dtor" only once.
According to ISO/IEC 14882:1998(E) section 6.6, the destructor of v
should be invoked each time the goto statement is executed:
"a transfer [...] back past an initialized variable with automatic
storage duration involves the destruction of variables with automatic
storage duration that are in scope at the point transferred from but
not at the point transferred to".
The program works correctly when compiled with gcc 2.95.
#include <iostream>
template <class T>
struct C {
C() { std::cout << "ctor\n"; }
~C() { std::cout << "dtor\n"; }
};
int main(int, char **) {
int i = 0;
again:
C<int> v;
if (++i < 10)
goto again;
}
--
Summary: Destructor not called on backwards goto past
initialization
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gson at gson dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386--netbsdelf
GCC host triplet: i386--netbsdelf
GCC target triplet: i386--netbsdelf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
@ 2004-03-24 23:00 ` bangerth at dealii dot org
2004-03-25 1:25 ` [Bug c++/14724] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-03-24 23:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-24 23:00 -------
Confirmed, a bad regression in 3.3/3.4/3.5 w.r.t. 2.95.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |wrong-code
Known to fail| |3.2.3 3.3.3 3.4.0 3.5.0
Known to work| |2.95
Last reconfirmed|0000-00-00 00:00:00 |2004-03-24 23:00:49
date| |
Target Milestone|--- |3.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
2004-03-24 23:00 ` [Bug c++/14724] " bangerth at dealii dot org
@ 2004-03-25 1:25 ` pinskia at gcc dot gnu dot org
2004-03-26 1:40 ` giovannibajo at libero dot it
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-25 1:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-25 01:25 -------
Note this is already fixed on the tree-ssa:
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
ctor
dtor
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work|2.95 |2.95 tree-ssa
Summary|Destructor not called on |[3.3/3.4/3.5 Regression]
|backwards goto past |Destructor not called on
|initialization |backwards goto past
| |initialization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
2004-03-24 23:00 ` [Bug c++/14724] " bangerth at dealii dot org
2004-03-25 1:25 ` [Bug c++/14724] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-26 1:40 ` giovannibajo at libero dot it
2004-03-26 15:14 ` bangerth at dealii dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-03-26 1:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-03-26 01:40 -------
For the logs, I can reproduce it with:
gcc version 3.3.4 20040218 (prerelease)
gcc version 3.4.0 20040216 (prerelease)
gcc version 3.2.2 (mingw special 20030208-1)
on i686-cygwin.
Andrew Pinski can reproduce it with:
gcc version 3.5.0 20040325 (experimental)
on i686-linux and powerpc-apple-darwin.
But RTH couldn't reproduce it with gcc version 3.3.3 (Debian) on alpha, or
mainline on linux. So there must be something weird going on.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (2 preceding siblings ...)
2004-03-26 1:40 ` giovannibajo at libero dot it
@ 2004-03-26 15:14 ` bangerth at dealii dot org
2004-03-30 22:19 ` mmitchel at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-03-26 15:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-03-26 15:14 -------
Hm, I can reproduce this with
gcc version 3.5.0 20040307 (experimental)
gcc version 3.4.0 20040319 (prerelease)
gcc version 3.3.4 20040223 (prerelease)
all on x86 linux...
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (3 preceding siblings ...)
2004-03-26 15:14 ` bangerth at dealii dot org
@ 2004-03-30 22:19 ` mmitchel at gcc dot gnu dot org
2004-03-30 23:43 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-30 22:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-03-30 22:19 -------
Working on a fix.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (4 preceding siblings ...)
2004-03-30 22:19 ` mmitchel at gcc dot gnu dot org
@ 2004-03-30 23:43 ` cvs-commit at gcc dot gnu dot org
2004-03-30 23:45 ` cvs-commit at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-30 23:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-03-30 23:43 -------
Subject: Bug 14724
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: mmitchel@gcc.gnu.org 2004-03-30 23:43:20
Modified files:
gcc/cp : ChangeLog decl.c pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/init: goto1.C
gcc/testsuite/g++.dg/template: defarg4.C
Log message:
PR c++/14724
* decl.c (start_decl_1): Do not decide whether or not to create a
new cleanup level until after the type has been completed.
PR c++/14763
* pt.c (tsubst_default_argument): Clear current_function_decl.
PR c++/14724
* g++.dg/init/goto1.C: New test.
PR c++/14763
* g++.dg/template/defarg4.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.89&r2=1.3892.2.90
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.17&r2=1.1174.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.21&r2=1.816.2.22
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.158&r2=1.3389.2.159
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/goto1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/defarg4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3/3.4/3.5 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (5 preceding siblings ...)
2004-03-30 23:43 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-30 23:45 ` cvs-commit at gcc dot gnu dot org
2004-03-30 23:47 ` [Bug c++/14724] [3.3 " mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-30 23:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-03-30 23:45 -------
Subject: Bug 14724
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2004-03-30 23:45:00
Modified files:
gcc/cp : ChangeLog decl.c pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/init: goto1.C
gcc/testsuite/g++.dg/template: defarg4.C
Log message:
PR c++/14724
* decl.c (start_decl_1): Do not decide whether or not to create a
new cleanup level until after the type has been completed.
PR c++/14763
* pt.c (tsubst_default_argument): Clear current_function_decl.
PR c++/14724
* g++.dg/init/goto1.C: New test.
PR c++/14763
* g++.dg/template/defarg4.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4018&r2=1.4019
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1198&r2=1.1199
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.844&r2=1.845
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3646&r2=1.3647
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/goto1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/defarg4.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (6 preceding siblings ...)
2004-03-30 23:45 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-30 23:47 ` mmitchel at gcc dot gnu dot org
2004-04-13 21:35 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-30 23:47 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-03-30 23:47 -------
Fixed in GCC 3.4 and GCC 3.5.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |NEW
Known to fail|3.2.3 3.3.3 3.4.0 3.5.0 |3.2.3 3.3.3
Known to work|2.95 tree-ssa |2.95 tree-ssa 3.4.0 3.5.0
Summary|[3.3/3.4/3.5 Regression] |[3.3 Regression] Destructor
|Destructor not called on |not called on backwards goto
|backwards goto past |past initialization
|initialization |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (7 preceding siblings ...)
2004-03-30 23:47 ` [Bug c++/14724] [3.3 " mmitchel at gcc dot gnu dot org
@ 2004-04-13 21:35 ` cvs-commit at gcc dot gnu dot org
2004-05-01 19:57 ` cvs-commit at gcc dot gnu dot org
2004-05-01 19:58 ` gdr at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-13 21:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-04-13 20:42 -------
Subject: Bug 14724
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-rhl-branch
Changes by: jakub@gcc.gnu.org 2004-04-13 20:41:57
Modified files:
gcc/cp : ChangeLog decl.c decl2.c pt.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/init: goto1.C
gcc/testsuite/g++.dg/template: defarg4.C
Log message:
2004-04-07 Jakub Jelinek <jakub@redhat.com>
* decl2.c (mark_used): Don't segfault if cfun != NULL but
current_function_decl == NULL.
2004-03-30 Mark Mitchell <mark@codesourcery.com>
PR c++/14724
* decl.c (start_decl_1): Do not decide whether or not to create a
new cleanup level until after the type has been completed.
PR c++/14763
* pt.c (tsubst_default_argument): Clear current_function_decl.
PR c++/14724
* g++.dg/init/goto1.C: New test.
PR c++/14763
* g++.dg/template/defarg4.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=1.3076.2.132.2.29&r2=1.3076.2.132.2.30
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=1.965.2.42.2.18&r2=1.965.2.42.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=1.575.2.28.2.6&r2=1.575.2.28.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=1.635.2.22.2.14&r2=1.635.2.22.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=1.2261.2.170.2.57&r2=1.2261.2.170.2.58
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/goto1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=NONE&r2=1.2.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/defarg4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-rhl-branch&r1=NONE&r2=1.2.10.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (8 preceding siblings ...)
2004-04-13 21:35 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-01 19:57 ` cvs-commit at gcc dot gnu dot org
2004-05-01 19:58 ` gdr at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-01 19:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-05-01 19:57 -------
Subject: Bug 14724
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: gdr@gcc.gnu.org 2004-05-01 19:57:29
Modified files:
gcc/cp : ChangeLog decl.c
Added files:
gcc/testsuite/g++.dg/init: goto1.C
Log message:
Backport from gcc-3_4-branch:
2004-03-30 Mark Mitchell <mark@codesourcery.com>
PR c++/14724
* decl.c (start_decl_1): Do not decide whether or not to
create a
new cleanup level until after the type has been completed.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/goto1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.20.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.265&r2=1.3076.2.266
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.81&r2=1.965.2.82
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/14724] [3.3 Regression] Destructor not called on backwards goto past initialization
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
` (9 preceding siblings ...)
2004-05-01 19:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-01 19:58 ` gdr at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-05-01 19:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at gcc dot gnu dot org 2004-05-01 19:58 -------
Fixed in 3.3.4 too.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14724
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-05-01 19:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 22:33 [Bug c++/14724] New: Destructor not called on backwards goto past initialization gson at gson dot org
2004-03-24 23:00 ` [Bug c++/14724] " bangerth at dealii dot org
2004-03-25 1:25 ` [Bug c++/14724] [3.3/3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-26 1:40 ` giovannibajo at libero dot it
2004-03-26 15:14 ` bangerth at dealii dot org
2004-03-30 22:19 ` mmitchel at gcc dot gnu dot org
2004-03-30 23:43 ` cvs-commit at gcc dot gnu dot org
2004-03-30 23:45 ` cvs-commit at gcc dot gnu dot org
2004-03-30 23:47 ` [Bug c++/14724] [3.3 " mmitchel at gcc dot gnu dot org
2004-04-13 21:35 ` cvs-commit at gcc dot gnu dot org
2004-05-01 19:57 ` cvs-commit at gcc dot gnu dot org
2004-05-01 19:58 ` gdr at gcc dot gnu dot 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).