public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object
@ 2003-09-16 13:43 raoulgough at yahoo dot co dot uk
  2003-09-16 13:57 ` [Bug c++/12298] " raoulgough at yahoo dot co dot uk
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: raoulgough at yahoo dot co dot uk @ 2003-09-16 13:43 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=12298

           Summary: Stack unwind destroys not-yet-constructed object
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raoulgough at yahoo dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-mingw
  GCC host triplet: i686-pc-mingw
GCC target triplet: i686-pc-mingw

The following code asserts instead of completing normally. The constructor call 
to foo_base never happens, because of an exception during parameter set up. 
Unfortunately, the unwind code then calls the destructor on the never-
constructed object. i686-pc-cygwin g++ 3.2 produces code that completes 
normally, i686-pc-mingw g++ 3.3.1 gets the assertion failure.


#include <cassert>

static unsigned int const kMagic = 0x0f00ba4e;

struct foo_base {
  unsigned mConstructed;
  foo_base (void *) : mConstructed (kMagic) { }
  ~foo_base () { assert (mConstructed == kMagic); }
};

void *check_ptr (void *ptr) {
  if (!ptr) throw ptr;

  return ptr;
}

int main (int argc, char *argv[]) {
  try {
    foo_base const &ref ((foo_base (check_ptr (0))));
  }

  catch (void *) { }
}


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

* [Bug c++/12298] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
@ 2003-09-16 13:57 ` raoulgough at yahoo dot co dot uk
  2003-09-16 14:58 ` bangerth at dealii dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: raoulgough at yahoo dot co dot uk @ 2003-09-16 13: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=12298



------- Additional Comments From raoulgough at yahoo dot co dot uk  2003-09-16 12:06 -------
Created an attachment (id=4771)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4771&action=view)
Assembly output from -save-temps

Produced from the command f:/mingw/bin/g++ -o throw throw.cpp -save-temps


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

* [Bug c++/12298] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
  2003-09-16 13:57 ` [Bug c++/12298] " raoulgough at yahoo dot co dot uk
@ 2003-09-16 14:58 ` bangerth at dealii dot org
  2003-09-26 15:17 ` raoulgough at yahoo dot co dot uk
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2003-09-16 14:58 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=12298


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bajo at gcc dot gnu dot org


------- Additional Comments From bangerth at dealii dot org  2003-09-16 14:30 -------
For me it's the other way round (on a linux box): with 3.2 I get the abort, with 3.3 and 
mainline the program terminates correctly. I guess this needs someone with a windows 
box to check. Giovanni? 
 
W.


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

* [Bug c++/12298] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
  2003-09-16 13:57 ` [Bug c++/12298] " raoulgough at yahoo dot co dot uk
  2003-09-16 14:58 ` bangerth at dealii dot org
@ 2003-09-26 15:17 ` raoulgough at yahoo dot co dot uk
  2003-09-27 12:59 ` [Bug c++/12298] [sjlj excepections] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: raoulgough at yahoo dot co dot uk @ 2003-09-26 15:17 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=12298



------- Additional Comments From raoulgough at yahoo dot co dot uk  2003-09-26 11:14 -------
Maybe this a generic sjlj exception handling problem? I'm not too clear on 
which compiler releases have used this mechanism, but the mingw compiler I have 
certainly does (note the --enable-sjlj-exceptions configure option below). 
Maybe the Linux versions mentioned by Wolfgang Bangerth used different EH 
mechanism between 3.2 and 3.3/mainline?

$ f:/mingw/bin/gcc -v
Reading specs from f:/mingw/bin/../lib/gcc-lib/mingw32/3.3.1/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,objc,ada,java --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x -
-enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchronization
Thread model: win32
gcc version 3.3.1 (mingw special 20030804-1)


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

* [Bug c++/12298] [sjlj excepections] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
                   ` (2 preceding siblings ...)
  2003-09-26 15:17 ` raoulgough at yahoo dot co dot uk
@ 2003-09-27 12:59 ` pinskia at gcc dot gnu dot org
  2003-09-30  5:26 ` dannysmith at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-27 12:59 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=12298


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-09-27 07:07:48
               date|                            |
            Summary|Stack unwind destroys not-  |[sjlj excepections] Stack
                   |yet-constructed object      |unwind destroys not-yet-
                   |                            |constructed object


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-27 07:07 -------
I can confirm this on the mainline (20030830) on i686-openbsd3.1 which uses sjlj 
exceptions but on the mainline (20030926) on i686-pc-linux-gnu (which uses dwarf 
exceptions) it is fine.  Also on the mainline (20030925) on powerpc-apple-darwin (which 
also uses dwarf exceptions) the code does not produce an assert.


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

* [Bug c++/12298] [sjlj excepections] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
                   ` (3 preceding siblings ...)
  2003-09-27 12:59 ` [Bug c++/12298] [sjlj excepections] " pinskia at gcc dot gnu dot org
@ 2003-09-30  5:26 ` dannysmith at gcc dot gnu dot org
  2003-10-08 23:52 ` dannysmith at gcc dot gnu dot org
  2003-10-08 23:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2003-09-30  5:26 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=12298



------- Additional Comments From dannysmith at gcc dot gnu dot org  2003-09-30 00:51 -------
Seems to be fixed on mainline on mingw32 (using sjlj).  Test case terminates 
normally.

Reading specs from D:/MINGW/BIN/../lib/gcc/mingw32/3.4/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --build=mingw32 --target=mingw32 --prefix=/mingw --enable-threads -
-disable-nls --enable-languages=c,c++ --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --disable-libstdcxx-pch  
Thread model: win32
gcc version 3.4 20030928 (experimental)


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

* [Bug c++/12298] [sjlj excepections] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
                   ` (4 preceding siblings ...)
  2003-09-30  5:26 ` dannysmith at gcc dot gnu dot org
@ 2003-10-08 23:52 ` dannysmith at gcc dot gnu dot org
  2003-10-08 23:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dannysmith at gcc dot gnu dot org @ 2003-10-08 23:52 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=12298



------- Additional Comments From dannysmith at gcc dot gnu dot org  2003-10-08 23:52 -------
The test case executes without assertion using

Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,objc,ada,java --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x -
-enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchronization
Thread model: win32
gcc version 3.3.2 20031007 (prerelease)

Should this bug be marked as FIXED with target 3.3.2?

Danny


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

* [Bug c++/12298] [sjlj excepections] Stack unwind destroys not-yet-constructed object
  2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
                   ` (5 preceding siblings ...)
  2003-10-08 23:52 ` dannysmith at gcc dot gnu dot org
@ 2003-10-08 23:55 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-08 23:55 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=12298


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.3.2


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-08 23:55 -------
Fixed two days after I tried this bug.


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

end of thread, other threads:[~2003-10-08 23:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-16 13:43 [Bug c++/12298] New: Stack unwind destroys not-yet-constructed object raoulgough at yahoo dot co dot uk
2003-09-16 13:57 ` [Bug c++/12298] " raoulgough at yahoo dot co dot uk
2003-09-16 14:58 ` bangerth at dealii dot org
2003-09-26 15:17 ` raoulgough at yahoo dot co dot uk
2003-09-27 12:59 ` [Bug c++/12298] [sjlj excepections] " pinskia at gcc dot gnu dot org
2003-09-30  5:26 ` dannysmith at gcc dot gnu dot org
2003-10-08 23:52 ` dannysmith at gcc dot gnu dot org
2003-10-08 23:55 ` pinskia 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).