------- Comment #13 from mikpe at it dot uu dot se  2010-05-29 14:27 -------
(In reply to comment #10)
> Or rather, if you have
> 
> void __attribute__((naked)) foo (int i)
> {
>   asm("use i");
> }
> 
> without any inputs refering to i that is invalid.

Not according to gcc/doc/extend.texi:

> @item naked
> @cindex function without a prologue/epilogue code
> Use this attribute on the ARM, AVR, IP2K, RX and SPU ports to indicate that
> the specified function does not need prologue/epilogue sequences generated by
> the compiler.  It is up to the programmer to provide these sequences. The 
> only statements that can be safely included in naked functions are 
> @code{asm} statements that do not have operands.

Note: "do not have operands".  Thus the only way such an asm() can refer to
parameters is by assuming a standard function call sequence and hardcoding
corresponding register numbers or stack frame offsets.

However, even if the asm() refers to those parameters via "r"(...) inputs,
gcc-4.5 changes the register assignment to not agree with the standard call
sequence, I'll attach a small test case showing that in a moment.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290

Reply via email to