http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46188
--- Comment #5 from Zdenek Sojka <zsojka at seznam dot cz> 2010-10-27 10:30:35 UTC --- Created attachment 22172 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22172 the second part of testcase I used this file to complete your testcase. It defines remaining functions and prints some debug output. (x86_86-pc-linux-gnu target) gcc-4.5.2 (r165781) $ g++ -O2 playground4.cxx playground_main.cxx && ./a.out pre-f() Array<B>::do_something() h(0x602030) h((nil)) post-f() h((nil)) h(0x602010) h((nil)) $ g++ -O2 -fno-ipa-cp playground4.cxx playground_main.cxx && ./a.out pre-f() Array<B>::do_something() h((nil)) h(0x602030) h((nil)) post-f() h((nil)) h(0x602010) h((nil)) gcc 4.6.0 (r165985) $ g++ -O2 playground4.cxx playground_main.cxx && ./a.out pre-f() Array<B>::do_something() h((nil)) h(0x602030) h((nil)) post-f() h((nil)) h(0x602010) h((nil)) For 4.5 -fipa-cp the output is different. I don't see anything obviously wrong with the testcase, and valgrind doesn't anyreport any errors. But I am certainly not an expert. Apart from this: #pragma interface #pragma interface "subdir/objects.h" Use this directive in header files that define object classes, to save space in most of the object files that use those classes. It's not a header file and #pragma implementation is nowhere... I suppose the testcase was reduced from preprocessed files.