Exception handling seems completely broken when -maix64 option is specified. I have tried with g++ version 3.4.0, 3.4.1, 3.4.2 20040829 (prerelease) respectively and got the same result. Following is a small test case. cleo% cat throw.cc #include <stdio.h> int main() { try{ throw 1; } catch( int i ) { printf("catch\n"); } return 0; } cleo% g++ -maix32 throw.cc -o throw; ./throw catch cleo% g++ -maix64 throw.cc -o throw; ./throw zsh: segmentation fault (core dumped) ./throw It works fine under -maix32 option, but when we want to compile in 64-bit mode the compiled binary crushes just after throw. I used native ld and as (which are the latest versions). The configure command line is ./configure --enable-languages=c,c++ --disable-nls
hmm, the only thing remotely close to this is PR 13391 but that delt with shared libraries.
The correct TOC pointer is not being restored in the exception handler catch block, so the call to __cxa_catch_begin in the shared library through glink code is loading the function address from the wrong TOC. The code works correctly in 32-bit mode and the algorithm is the same, so the failure is very suspicious.
Subject: Bug 17277 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: dje@gcc.gnu.org 2004-09-11 17:10:25 Modified files: gcc : ChangeLog gcc/config/rs6000: aix.h Log message: PR target/17277 * config/rs6000/aix.h (MD_FROB_UPDATE_CONTEXT): Use __64BIT__ to choose 64-bit version. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.617&r2=2.2326.2.618 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/aix.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.43.4.2&r2=1.43.4.3
Subject: Bug 17277 CVSROOT: /cvs/gcc Module name: gcc Changes by: dje@gcc.gnu.org 2004-09-11 17:11:05 Modified files: gcc : ChangeLog Log message: Add PR target/17277 to ChangeLog entry. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5391&r2=2.5392
Fixed in GCC 3.4.3 and mainline.
The exact same code/application compiles and runs fine on multiple OS's ( HP UX, Windows , Red Hat etc ) , i am seeing the problem only on AIX 7.1 But when you say this problem could be something other than AIX 7.1, could it be the environment variables, or a mismatch in the shared libs used. Btw, a shared lib , compiled with gcc on AIX 7.1, but in C language is also being used. Would you suggest using a lower verion of the gcc compiler what we used?