public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19958] New: Global object destroyed that is not constructed
@ 2005-02-14 21:02 sabre at nondot dot org
  2005-02-14 21:05 ` [Bug c++/19958] " sabre at nondot dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sabre at nondot dot org @ 2005-02-14 21:02 UTC (permalink / raw)
  To: gcc-bugs

Consider this testcase:

---
#include <stdlib.h>
#include <stdio.h>

struct A { 
  A() { printf("a\n"); exit(1); }
  ~A() { printf("~a\n"); }
} a;

struct B { 
  B() { printf("b\n"); }
  ~B() { printf("~b\n"); }
} b;
int main() {}
---

G++ 3.4.0, 3.4.2, and 2.96 print:
a
~b
~a

... which destroys B without constructing it.


G++ 3.3.2 prints:
a

... which seems correct (A has not finished construction).

-Chris

-- 
           Summary: Global object destroyed that is not constructed
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19958


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19958] Global object destroyed that is not constructed
  2005-02-14 21:02 [Bug c++/19958] New: Global object destroyed that is not constructed sabre at nondot dot org
@ 2005-02-14 21:05 ` sabre at nondot dot org
  2005-02-14 22:10 ` pinskia at gcc dot gnu dot org
  2005-02-14 22:26 ` sabre at nondot dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sabre at nondot dot org @ 2005-02-14 21:05 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.0 3.4.2 2.96
      Known to work|                            |3.3.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19958


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19958] Global object destroyed that is not constructed
  2005-02-14 21:02 [Bug c++/19958] New: Global object destroyed that is not constructed sabre at nondot dot org
  2005-02-14 21:05 ` [Bug c++/19958] " sabre at nondot dot org
@ 2005-02-14 22:10 ` pinskia at gcc dot gnu dot org
  2005-02-14 22:26 ` sabre at nondot dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-14 22:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-14 19:46 -------
You know your 3.3.x is compiled with --enable-__cxa_atexit.

This is a dup of bug 2474 which is very known bug which only can be fixed via using --enable-
__cxa_atexit on supported targets.

*** This bug has been marked as a duplicate of 2474 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19958


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19958] Global object destroyed that is not constructed
  2005-02-14 21:02 [Bug c++/19958] New: Global object destroyed that is not constructed sabre at nondot dot org
  2005-02-14 21:05 ` [Bug c++/19958] " sabre at nondot dot org
  2005-02-14 22:10 ` pinskia at gcc dot gnu dot org
@ 2005-02-14 22:26 ` sabre at nondot dot org
  2 siblings, 0 replies; 4+ messages in thread
From: sabre at nondot dot org @ 2005-02-14 22:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sabre at nondot dot org  2005-02-14 19:53 -------
I don't really think this is the same as 2474: that is an issue of ctor
ordering, this is one of *destroying objects that weren't created*.

-Chris

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19958


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-14 19:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-14 21:02 [Bug c++/19958] New: Global object destroyed that is not constructed sabre at nondot dot org
2005-02-14 21:05 ` [Bug c++/19958] " sabre at nondot dot org
2005-02-14 22:10 ` pinskia at gcc dot gnu dot org
2005-02-14 22:26 ` sabre at nondot 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).