You have not properly described the side effects of either the movsl instruction nor the rep prefix. The values loaded by the "S", "D", and "c" constraints are all clobbered by the time the instruction sequence completes. If you do not inform the code generator of this it assumes that the registers remain unchanged. /john -----Original Message----- From: Studious Apprentice [mailto:apprentice_99@xxxxxxxxxxx] Sent: Monday, February 06, 2006 3:32 AM To: gcc-help@xxxxxxxxxxx Subject: Pb with G++ 3.4.2 MinGW and inline assembly 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" ); }