Pb with G++ 3.4.2 MinGW and inline assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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"
		);
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux