https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61637
David Edelsohn <dje at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed|2014-06-28 00:00:00 |2014-06-30 Ever confirmed|0 |1 --- Comment #14 from David Edelsohn <dje at gcc dot gnu.org> --- 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.