I'm still getting this in Visual Studio 2012 RC. Is the fix supposed to be in there? If not is it possible to get access to a fixed compiler version so I can verify the fix before RTM?

Posted by Microsoft on 5/15/2012 at 11:16 AM

Again, thank you for reporting this. I thought I'd give you an update. We've checked in a fix for failing to emit the REX prefix. Here's a snippet of disasm from the fs_LaunchExecutable that shows, at the end of the snippet, the corrected emission of the REX prefix.

Okay, thanks for staying on this. Based on your feedback i took the additional step of disassembling the binary and lo and behold it looks like there's an encoding problem in the compiler. The listing file generated by the compiler (via /Fa) has this:

and QWORD PTR [rcx], 1

But the disasembly of the final binary (done via link.exe /dump /disasm) contains this:

and dword ptr [rcx],1

The compiler thinks it's emitting a QWORD load/store, but it is in fact emitting a DWORD load/store.

I or someone from my team will post back once we know more.

ian BearmanPrincipal DeveloperVC++ Code Generation and Optimization

Posted by Erik Olofsson on 4/11/2012 at 1:36 AM

I'm overwriting the stack just to demonstrate the problem. Without that the stack will be 0 for the member variable in this example, so it would not show any difference in outcome depending on DWORD or QWORD and.

And the compiler version (x86 cross compiler):Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50214.1 for x64

Posted by Microsoft on 4/10/2012 at 3:50 PM

Thanks for taking the time to file this report. Unfortunately, I’m not able to reproduce the issue you are seeing regarding DWORD vs. QWORD. I compiled the code you provide using the x64 compiler with -O2 optimization level.

*Note that m_TestLink is an uninitialized member variable at this point and its value is undefined. I think you may be attempting to write to it using ::fg_CorreuptMemory, but that is strongly dependent on stack layout which is different between debug and optimized builds.

Please let me know if there’s something else I need to do to generate the failure (different compiler optimizations, etc)