http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55171
Mikael Pettersson <mikpe at it dot uu.se> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikpe at it dot uu.se --- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2012-11-11 14:30:14 UTC --- It's caused by "[patch i386]: Set for method-functions default calling-convention to thiscall for 32-bit msabi" in r171890: http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00066.html http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg00082.html With x86_64-w64-mingw32-g++ -m32 -O2 there are numerous code generation differences in r171890 for this test case (as expected with the changed calling convention), but looking only at the virtual thunk we see: --- pr55171.s-r171889 2012-11-11 14:51:38.000000000 +0100 +++ pr55171.s-r171890 2012-11-11 15:00:58.000000000 +0100 ... __ZTv0_n16_NK7Derived3fooEv: - movl 8(%esp), %eax - movl (%eax), %ecx - addl -16(%ecx), %eax - movl %eax, 8(%esp) + movl 4(%esp), %eax + movl (%eax), %eax + addl -16(%eax), %eax + movl %eax, 4(%esp) jmp LTHUNK2 ... The two code sequences are clearly not equivalent (ignore the stack position of the pointer being adjusted). Running the test case confirms: with g++ @ r171889 it succeeds, but with g++ @ r171890 it gets a runtime failure.