This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12751] [tree-ssa] wrong code: double destruction


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]