public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12751] New: [tree-ssa] wrong code: double destruction
@ 2003-10-24 0:04 stefaandr at hotmail dot com
2003-10-24 0:57 ` [Bug c++/12751] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: stefaandr at hotmail dot com @ 2003-10-24 0:04 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
Summary: [tree-ssa] wrong code: double destruction
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stefaandr at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
I get the output:
Construct
Destruct
Destruct
when running this code (sorry, couldn't get it smaller):
#include <iostream>
struct a {
a() { std::cout << "Construct" << std::endl; };
~a() { std::cout << "Destruct" << std::endl; };
};
int main() {
a a1;
std::string x;
switch(0) {
case 1:
{
a a2;
return 0;
}
};
};
Reading specs from /esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa/specs
Configured with: ../../gcc/ssa/configure --prefix=/esat/firenze/install
--program-suffix=-ssa --enable-languages=c,c++ : (reconfigured) :
(reconfigured)
Thread model: posix
gcc version 3.5-tree-ssa 20031023 (merged 20031017)
/esat/firenze/install/libexec/gcc/i686-pc-linux-gnu/3.5-tree-ssa/cc1plus
-quiet -v -D_GNU_SOURCE test6.cpp -quiet -dumpbase test6.cpp -mtune=pentiumpro
-auxbase test6 -version -o /tmp/ccPznGwZ.s
ignoring nonexistent directory "/esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/esat/firenze/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../
include/c++/3.5-tree-ssa
/esat/firenze/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../
include/c++/3.5-tree-ssa/i686-pc-linux-gnu
/esat/firenze/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/../../../../
include/c++/3.5-tree-ssa/backward
/usr/local/include
/esat/firenze/install/include
/esat/firenze/install/lib/gcc/i686-pc-linux-gnu/3.5-tree-ssa/include
/usr/include
End of search list.
GNU C++ version 3.5-tree-ssa 20031023 (merged 20031017) (i686-pc-linux-gnu)
compiled by GNU C version 3.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
as -V -Qy -o /tmp/ccRkDD1N.o /tmp/ccPznGwZ.s
GNU assembler version 2.14 (i686-pc-linux-gnu) using BFD version 2.14 20030612
/esat/firenze/install/libexec/gcc/i686-pc-linux-gnu/3.5-tree-ssa/collect2
--eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test6 /usr/
lib/crt1.o /usr/lib/crti.o /esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa/crtbegin.o -L/esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa -L/esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa/../../.. /tmp/ccRkDD1N.o -lstdc++ -lm -lgcc_s
-lgcc -lc -lgcc_s -lgcc /esat/firenze/install/lib/gcc/
i686-pc-linux-gnu/3.5-tree-ssa/crtend.o /usr/lib/crtn.o
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
@ 2003-10-24 0:57 ` pinskia at gcc dot gnu dot org
2003-10-27 18:15 ` bangerth at dealii dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-24 0:57 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-24 00:32 -------
This looks like an eh problem because in gimple it looks right.
Here is a different example that uses printf instead of cout:
#include <string>
extern "C" int printf(const char*,...);
struct a {
a() { printf("%p->a()\n");}
~a() { printf("%p->a()\n"); }
};
int main() {
a a1;
std::string x;
switch(0) {
case 1:
{
a a2;
return 0;
}
};
};
0xbffffd18->a()
0xbffffba0->a()
0x0->a()
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
2003-10-24 0:57 ` [Bug c++/12751] " pinskia at gcc dot gnu dot org
@ 2003-10-27 18:15 ` bangerth at dealii dot org
2003-10-27 22:40 ` bangerth at dealii dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-10-27 18:15 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-10-27 18:08:20
date| |
------- Additional Comments From bangerth at dealii dot org 2003-10-27 18:08 -------
Andrew's code is close, but not quite valid. Here's a valid variant:
---------------------------------
#include <string>
extern "C" int printf(const char*,...);
struct a {
a() { printf("a::a\n"); }
~a() { printf("a::~a\n"); }
};
int main() {
a a1;
std::string x;
switch(0) {
case 1:
{
a a2;
return 0;
}
};
};
-------------------------------------------
I can confirm the failure with a tree-ssa snapshot from 20031024.
W.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (2 preceding siblings ...)
2003-10-27 22:40 ` bangerth at dealii dot org
@ 2003-10-27 22:40 ` bangerth at dealii dot org
2003-10-27 22:45 ` [Bug c++/12751] [tree-ssa] [eh] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-10-27 22:40 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
------- Additional Comments From bangerth at dealii dot org 2003-10-27 22:40 -------
Just as Andrew mentioned there:
Most likely the same bug as PR 12789.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
2003-10-24 0:57 ` [Bug c++/12751] " pinskia at gcc dot gnu dot org
2003-10-27 18:15 ` bangerth at dealii dot org
@ 2003-10-27 22:40 ` bangerth at dealii dot org
2003-10-27 22:40 ` bangerth at dealii dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-10-27 22:40 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Keywords| |wrong-code
Target Milestone|--- |tree-ssa
------- Additional Comments From bangerth at dealii dot org 2003-10-27 22:33 -------
Here's a small, self-contained, testcase:
--------------------
extern int printf (__const char *__restrict __format, ...) throw ();
struct Y {
Y() { printf("Y::Y\n");}
~Y() { printf("Y::~Y\n"); }
};
int main() {
Y y1;
Y y2;
switch(0) {
case 1:
{
Y y3;
return 0;
}
};
};
---------------------------
When compiled with tree-ssa, I get this as output:
g/x> /home/bangerth/bin/gcc-tree-ssa/bin/c++ y.cc && ./a.out
Y::Y
Y::Y
Y::~Y
Y::~Y
Y::~Y
That is, two constructor, and three destructor calls (and no copy constructors
in between). That's definitely wrong.
W.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] [eh] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (3 preceding siblings ...)
2003-10-27 22:40 ` bangerth at dealii dot org
@ 2003-10-27 22:45 ` pinskia at gcc dot gnu dot org
2003-10-30 1:47 ` rth at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-27 22:45 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[tree-ssa] wrong code: |[tree-ssa] [eh] wrong code:
|double destruction |double destruction
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-27 22:42 -------
With printing out "this" (which is what my first attempt was going to do):
extern int printf (__const char *__restrict __format, ...) throw ();
struct Y {
Y() { printf("Y(%p)::Y\n", this);}
~Y() { printf("Y(%p)::~Y\n", this); }
};
int main() {
Y y1;
Y y2;
switch(0) {
case 1:
{
Y y3;
return 0;
}
};
};
You get:
Y(0xbffffd10)::Y
Y(0xbffffd20)::Y
Y(0xbffffd20)::~Y
Y(0xbffffd10)::~Y
Y(0xbffffd10)::~Y
Also note that gimple looks fine (but eh has too many labels/gotos to figure out what is going on).
Note -fno-exceptions also fixes the problem.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] [eh] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (4 preceding siblings ...)
2003-10-27 22:45 ` [Bug c++/12751] [tree-ssa] [eh] " pinskia at gcc dot gnu dot org
@ 2003-10-30 1:47 ` rth at gcc dot gnu dot org
2003-10-30 5:03 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2003-10-30 1:47 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
rth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rth at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
------- Additional Comments From rth at gcc dot gnu dot org 2003-10-30 01:46 -------
Mine.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] [eh] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (5 preceding siblings ...)
2003-10-30 1:47 ` rth at gcc dot gnu dot org
@ 2003-10-30 5:03 ` pinskia at gcc dot gnu dot org
2003-11-14 7:55 ` cvs-commit at gcc dot gnu dot org
2003-11-14 7:59 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-30 5:03 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-30 04:53 -------
*** Bug 12789 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] [eh] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (6 preceding siblings ...)
2003-10-30 5:03 ` pinskia at gcc dot gnu dot org
@ 2003-11-14 7:55 ` cvs-commit at gcc dot gnu dot org
2003-11-14 7:59 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-11-14 7:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-11-14 07:55 -------
Subject: Bug 12751
CVSROOT: /cvs/gcc
Module name: gcc
Branch: tree-ssa-20020619-branch
Changes by: rth@gcc.gnu.org 2003-11-14 07:55:11
Modified files:
gcc : ChangeLog.tree-ssa tree-eh.c
Added files:
gcc/testsuite/g++.dg/eh: dtor2.C
Log message:
PR c++/12751
* tree-eh.c (struct leh_tf_state): Add outer.
(lower_try_finally, lower_cleanup): Set it.
(lower_try_finally_fallthru_label): New.
(honor_protect_cleanup_actions): Use it.
(lower_try_finally_copy, lower_try_finally_switch): Likewise.
* g++.dg/eh/dtor2.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.862&r2=1.1.2.863
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-eh.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.13&r2=1.1.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/eh/dtor2.C.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/12751] [tree-ssa] [eh] wrong code: double destruction
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
` (7 preceding siblings ...)
2003-11-14 7:55 ` cvs-commit at gcc dot gnu dot org
@ 2003-11-14 7:59 ` rth at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2003-11-14 7:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rth at gcc dot gnu dot org 2003-11-14 07:59 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12751
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-11-14 7:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-24 0:04 [Bug c++/12751] New: [tree-ssa] wrong code: double destruction stefaandr at hotmail dot com
2003-10-24 0:57 ` [Bug c++/12751] " pinskia at gcc dot gnu dot org
2003-10-27 18:15 ` bangerth at dealii dot org
2003-10-27 22:40 ` bangerth at dealii dot org
2003-10-27 22:40 ` bangerth at dealii dot org
2003-10-27 22:45 ` [Bug c++/12751] [tree-ssa] [eh] " pinskia at gcc dot gnu dot org
2003-10-30 1:47 ` rth at gcc dot gnu dot org
2003-10-30 5:03 ` pinskia at gcc dot gnu dot org
2003-11-14 7:55 ` cvs-commit at gcc dot gnu dot org
2003-11-14 7:59 ` rth 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).