I had almost the same problem - including the bad cast - on AIX 5.2 and gcc 4.1.1.
My application uses pthreads. My application packags up the libraries it needs to execute - and I was using /usr/local/lib/libstdc++.a when I really wanted /usr/local/lib/pthread/libstdc++.a You can see the path to the correct libraries with the commands I use below: On my machine, gcc -v returns: Using built-in specs. Target: powerpc-ibm-aix5.2.0.0 Configured with: ../gcc-4.1.1/configure --disable-aix64 --disable-nls Thread model: aix gcc version 4.1.1 The command gcc -pthread -print-file-name=libstdc++.a returns /usr/local/lib/gcc/powerpc-ibm-aix5.2.0.0/4.1.1/../../../pthread/libstdc++.a This is the threaded version that I needed The command gcc -print-file-name=libstdc++.a returns /usr/local/lib/gcc/powerpc-ibm-aix5.2.0.0/4.1.1/../../../libstdc++.a This is the unthreaded version I was using initially... ---------------------------------------------------- -- View this message in context: http://www.nabble.com/Problem-when-using-optimization-on-aix-5.2-and-gcc-4.1.1-tf3791592.html#a10768690 Sent from the gcc - Dev mailing list archive at Nabble.com.