------- Comment #15 from rguenth at gcc dot gnu dot org 2010-05-29 14:45 ------- (In reply to comment #13) > (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.
Then the target has to properly communicate this to the middle-end. > 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. I'd have required dummy inputs like "g" (kto), "g" (kfrom) not used by the actual assembly. For now re-open as a target bug. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | Summary|[4.5 Regression] arm linux |[4.5 Regression] __naked |kernel crahes when built |attribute is broken |with -fipa-sra, __naked | |attribute is broken | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290