Log in

View Full Version : Question on GCC inline-assembly


roozhou
13th October 2008, 13:34
My code looks like this

for (...)
{
printf("pdst = %d\n", pdst);
asm volotile
(
...
:
: "D"(pdst), "S"(psrc) ...
: "memory"
);
printf("pdst = %d\n", pdst);
}


It is quite strange that at the 2nd "printf" the value of "pdst" has changed. It seems gcc writes edi back to pdst at the end of asm block. But there is no write to "pdst" within asm block and its value should not be modified. Is there a way to fix it?