* Pb with G++ 3.4.2 MinGW and inline assembly
@ 2006-02-06 8:31 Studious Apprentice
2006-02-06 8:37 ` Namespace problem Edward Yang
0 siblings, 1 reply; 3+ messages in thread
From: Studious Apprentice @ 2006-02-06 8:31 UTC (permalink / raw)
To: gcc-help
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"
);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Namespace problem
2006-02-06 8:31 Pb with G++ 3.4.2 MinGW and inline assembly Studious Apprentice
@ 2006-02-06 8:37 ` Edward Yang
2006-02-06 15:01 ` Gabriel Dos Reis
0 siblings, 1 reply; 3+ messages in thread
From: Edward Yang @ 2006-02-06 8:37 UTC (permalink / raw)
To: gcc-help
I am not sure if it is a Microsoft specific extension.
The following code compiles correctly using the latest C/C++ compiler
(2005) from Microsoft.
namespace C
{
enum T
{
A,
B,
C,
};
}
int a = C::T::A;
When I compile it using MinGW, gcc produces:
main.cxx:163: error: `C::T' is not a class or namespace
main.cxx:163: error: expected primary-expression before ';' token
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Namespace problem
2006-02-06 8:37 ` Namespace problem Edward Yang
@ 2006-02-06 15:01 ` Gabriel Dos Reis
0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Dos Reis @ 2006-02-06 15:01 UTC (permalink / raw)
To: Edward Yang; +Cc: gcc-help
Edward Yang <neo_in_matrix@fastmail.fm> writes:
| I am not sure if it is a Microsoft specific extension.
It is.
-- Gaby
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-02-06 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-06 8:31 Pb with G++ 3.4.2 MinGW and inline assembly Studious Apprentice
2006-02-06 8:37 ` Namespace problem Edward Yang
2006-02-06 15:01 ` Gabriel Dos Reis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).