http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57003
Kirill Smirnov <kirill.k.smirnov at math dot spbu.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kirill.k.smirnov at math | |dot spbu.ru --- Comment #7 from Kirill Smirnov <kirill.k.smirnov at math dot spbu.ru> 2013-04-23 09:44:03 UTC --- It seems gcc over-optimizes series of memcpy() function calls one after another. The piece of code does not work: memcpy( buffer, DIR_Windows, len * sizeof(WCHAR) ); memcpy( buffer + len, default_syswow64W, sizeof(default_syswow64W) There is a wrapper around memcpy() called memcpy_unaligned() to avoid builtin/inlining. And these pieces of code work: memcpy( buffer, DIR_Windows, len * sizeof(WCHAR) ); memcpy_unaligned( buffer + len, default_syswow64W, sizeof(default_syswow64W) ); and memcpy_unaligned( buffer, DIR_Windows, len * sizeof(WCHAR) ); memcpy( buffer + len, default_syswow64W, sizeof(default_syswow64W) ); I'm sorry for copy-and-pasting wine code as is, I tried but failed to create a refined test case. So this case is opposite as previously suggested: the memcpy_unaligned() wrapper is OK, but native memcpy() is failing.