public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: AIX/g++: Preventing early destruction of exception handling
       [not found] <OF18CE6E29.09953371-ONC2257401.000AD671-C2257401.000AF293@LocalDomain>
@ 2008-03-03  8:53 ` Michael Veksler
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Veksler @ 2008-03-03  8:53 UTC (permalink / raw)
  To: Michael Veksler; +Cc: gcc-help

I omitted one important detail:
$ g++ -v
Using built-in specs.
Target: powerpc-ibm-aix5.3.0.0
Configured with: ../configure --prefix=/usr/local/gcc-4.2.2
--enable-languages=c,c++ --with-as=/usr/bin/as --with-ld=/usr/bin/ld
--disable-nls --enable-threads --enable-version-specific-runtime-libs
--host=powerpc-ibm-aix5.3.0.0
Thread model: aix
gcc version 4.2.2

Also, trying to use the at_exit mechanism for destruction does not work:
$ g++ -fuse-cxa-atexit t2.cpp
ld: 0711-317 ERROR: Undefined symbol: __dso_handle
ld: 0711-317 ERROR: Undefined symbol: .__cxa_atexit



                                                                       
             Michael                                                   
             Veksler/Haifa/IBM                                         
                                                                        To
             03/03/08 03:59            gcc-help@gcc.gnu.org            
                                                                        cc
                                                                       
                                                                   Subject
                                       AIX/g++: Preventing early       
                                       destruction of exception handling
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       



The following trivial code crashes on AIX-5.3 + gcc-4.2.2 (same with
gcc-3.4.3):

$ cat t.cpp
struct A { ~A() { try {throw 1;} catch(...) {} } };
A a;
int main() { }
$ g++ -g t.cpp
$ ./a.out
Abort

It looks like the libgcc_s.a(shr.o) library is destroyed (along with
exception supporting data structures) before the destructor of A has been
called. This is done by a function named _GLOBAL__FD_shr_o which seems to
be responsible for destruction of all global objects in libgcc.

When the destructor of A is called (by _GLOBAL__FD_a_out), exception
handling mechanism is already dead.

Is there anything constructive I can do to overcome this hurdle?
Should I open a PR (unless there is one, already open).
As far as I can tell, my code is well specified and defined from the ISO-C+
+ point of view, and is accepted on gcc+Linux and xlC+AIX. Only gcc+AIX
happens to problematic.


Thanks
   Michael

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

* AIX/g++: Preventing early destruction of exception handling
@ 2008-03-03  1:59 Michael Veksler
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Veksler @ 2008-03-03  1:59 UTC (permalink / raw)
  To: gcc-help


The following trivial code crashes on AIX-5.3 + gcc-4.2.2 (same with
gcc-3.4.3):

$ cat t.cpp
struct A { ~A() { try {throw 1;} catch(...) {} } };
A a;
int main() { }
$ g++ -g t.cpp
$ ./a.out
Abort

It looks like the libgcc_s.a(shr.o) library is destroyed (along with
exception supporting data structures) before the destructor of A has been
called. This is done by a function named _GLOBAL__FD_shr_o which seems to
be responsible for destruction of all global objects in libgcc.

When the destructor of A is called (by _GLOBAL__FD_a_out), exception
handling mechanism is already dead.

Is there anything constructive I can do to overcome this hurdle?
Should I open a PR (unless there is one, already open).
As far as I can tell, my code is well specified and defined from the ISO-C+
+ point of view, and is accepted on gcc+Linux and xlC+AIX. Only gcc+AIX
happens to problematic.


Thanks
   Michael

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

end of thread, other threads:[~2008-03-03  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <OF18CE6E29.09953371-ONC2257401.000AD671-C2257401.000AF293@LocalDomain>
2008-03-03  8:53 ` AIX/g++: Preventing early destruction of exception handling Michael Veksler
2008-03-03  1:59 Michael Veksler

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).