> I found strange inline code behavior:
> __asm__ __volatile__(
> "mov %[TAIV],r1 \n"
> "mov %[adc],r15 \n"
> :"=m" (x)
> :[TAIV] "im" (TAIV),[adc] "m" (adc)
> );
> the above code doesn't compile because of [TAIV]. if I remove [TAIV] the
> below
> code compiles properly:
> __asm__ __volatile__(
> "mov %1,r1 \n"
> "mov %[adc],r15 \n"
> :"=m" (x)
> :"im" (TAIV),[adc] "m" (adc)
> );
>
> Strange! Looks like a bug
Let me guess... TAIV is a #define?
Suppose we have #define TAIV 0x1234. Then, after the C preprocessor is
done with the above, you are left with
__asm__ __volatile__(
"mov %[TAIV],r1 \n"
"mov %[adc],r15 \n"
:"=m" (x)
:[0x1234] "im" (0x1234), [adc] "m" (adc)
);
At this point, you should no longer be surprised that it doesn't
compile...
Note, however, that I had to *guess*. You could have used the
preprocessor to redefine, "adc", "__asm__" or "__volatile__" as well,
with equally strange effects on compilation.
This is why it's important to submit *preprocessor output* (gcc -E)
when even *thinking* about a compiler bug.