GCC is way too smart or buggy and will (at least in this case) remove (optimize away) non __volatile__ asm statements :(

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2003-06-21 02:08:03 +00:00
parent 88777023cd
commit 50be0c99cf

View File

@ -65,7 +65,9 @@ swap_int16(void *buffer, size_t bytecount)
// output operand outputting to an unused dummy variable.
uint32 dummy1;
uint32 dummy2;
asm (
// GCC is way too smart and will remove the complete asm statement
// if we do not specify it as __volatile__. Don't remove that!
__asm__ __volatile__ (
"pushl %%ebx \n\t"
"movl %%eax, %%ebx \n\t"
"movl %%edx, %%eax \n\t"