Possible bug in arm-linux-GCC 2.95.3 with inline asm

hanishkvc@fedtec.com hanishkvc@fedtec.com
Wed Aug 8 00:47:00 GMT 2001


Hi

By looking into the asm code generated I understood that its using R11
as a frame pointer. Also I accept I haven't looked into the register
usage convention for C under arm compilers. However I have one
question

If one specified that r11 is being corrupted using the mangle list
mechanism of gcc's inline asm logic. Then shouldn't gcc take care of
saving and restoring it properly (around the inline asm code) if it
requires to use r11 for its own purpose.

Or at the other end atleast give a error if it can't do it. Otherwise
whats the use of specifying the mangle list.


Keep :-)
HanishKVC


On Wed, 8 Aug 2001, Philip Blundell wrote:

> >Hi
> >void debug_uart (unsigned int dbgchartoprint)
> >{
> >	__asm__ __volatile__
> >	(
> >	      " mov  r10, #0xd000
> >                add  r10, r10, #4
> >                mov  r10, r10, lsl #16
> >                add  r10, r10, #0x4000
> >	9:	ldr  r11, [r10, #0x018]
> >		ands r11, r11, #0x020 @0x08
> >		bne  9b
> >		str %0, [r10] "
> >            :
> >	    : "r" (dbgchartoprint)
> >            : "r10", "r11"
> >	);    /* o/p, i/p and mangle list */
> >}
>
> You are clobbering the frame pointer.
>
> Why are you even using inline asm for this at all?  You can write that
> code in
> C just as well without any of these problems.  But, if you feel you must
> write
> in asm, let the compiler choose the registers for you or pick some more
> innocuous ones.
>
> p.
>


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list