https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61637

--- Comment #16 from Krishnamoorthy C <chandrakm at hotmail dot com> ---
(In reply to David Edelsohn from comment #14)
> The AIX 7.1 system in the GCC Compile Farm has GCC 4.8.1 from Perzl
> installed. As I wrote before, I tried your example program (without the
> second "e" outside scope) using
> 
> g++ -O2
> g++ -O2 -maix64
> g++ -O2 -pthread
> g++ -O2 -maix64 -pthread
> g++ -O2 -fPIC
> g++ -O2 -maix64 -fPIC
> g++ -O2 -pthread -fPIC
> g++ -O2 -maix64 -pthread -fPIC
> 
> All of them produce executables that produce the result
> 
> "This is not caught 20".
> 
> The "-shared" and other options do not make sense unless one is building a
> shared library.
> 
> Have you tried a simple test?  Without all of your additional options? I
> don't understand why you choose the path of adding more options for AIX
> linker and GCC before you try a simple test to see if your earlier,
> complicated compile and link line are the cause of the problem.


Here is some more diagnostic information. I simplified the code:

1. My original intent was to use my code in a sharelib, where __attribute__
(constructor) Initfunction() is also defined, for some initialization.  Let us
call the cpp fil with the __attribute__  statement as Test.cpp

2. to simplify , created a main.cpp with main() and compile it as binary ,it
runs fine. 

3. When i again link this main.cpp with the Test.cpp which has __attribute__ ,
then the code executes fine until an exception is throw in the code  and inside
the catch statement , i see a core dump and the see this error "terminate
called after throwing an instance of '<Namespace>::<derived exception class
from std::exepction>'
terminate called recursively IOT/Abort trap (core dumped)"


When I remove the Test.cpp file from compiler/linker, main.cpp works fine. 
When   i put the file back, core dump happens. so inside the Initfunction()
with __attribute__ (constructor)  core dump is thrown, when I try to throw and
catch an exception .

Reply via email to