This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Possible bug in arm-linux-GCC 2.95.3 with inline asm
- To: Philip Blundell <philb at gnu dot org>
- Subject: Re: Possible bug in arm-linux-GCC 2.95.3 with inline asm
- From: <hanishkvc at fedtec dot com>
- Date: Wed, 8 Aug 2001 13:29:35 +0530 (IST)
- cc: <gcc-bugs at gcc dot gnu dot org>, <crossgcc at sources dot redhat dot com>, Russell King <rmk at arm dot linux dot org dot uk>
- Reply-To: <hanishkvc at fedtec dot com>
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.
>