Hello !
G++ seems to use a register which should have been clobbered with inline
assembly.
I am using the following assembly code (80x86) to inline a fast memcpy for
variable dword lengths arguments. The program works well in debug mode :"g++
-g" but not in optimized mode : "g++ -g -Wall -O2 -DNDEBUG". The compilation
is fine but GCC reuses the EDI register after inlining this routine, which
hangs my program. It is no longer possible to explicitly indicate a register
as clobbered when it is already used as a parameter, so I do not see any
workaround for what looks a bug.
Any idea ?
Thanks in advance,
Charles
inline void fast_memcopy
(void * where, void const * from, std::size_t times)
{
__asm__ __volatile__
(
"cld\n\t"
"rep\n\t"
"movsl"
:
: "S"(from), "D"(where), "c"(times)
: "memory"
);
}