This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug c++/11807] Wrong usage of registers on ARM
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: gcc-bugzilla at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Tue, 05 Aug 2003 18:50:55 +0100
- Subject: Re: [Bug c++/11807] Wrong usage of registers on ARM
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> I'm not using fp explicitely in my code, as you can see in test.ii. I just
> preserve it across system calls. The compiler uses fp to store non-pointer
> values in fp and later uses it as pointer!
>
> So it is seemingly a BUG.
No, this asm statement clobbers fp (or appears to):
extern __inline__ l4_threadid_t l4_myself(void)
{
l4_threadid_t id;
asm volatile
(
" stmdb sp!, {fp} \n"
" mov r0, %2 \n"
" mov lr, pc \n"
" mov pc, %1 \n"
" mov %0, r1 \n"
" ldmia sp!, {fp} \n"
:"=r" (id)
:"i" ((-0x00000008-8)),
"i" (((l4_threadid_t) { raw : 0 }).raw)
:"r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
"r10", "r11", "r12", "r14", "memory");
return id;
}
This *will* confuse the compiler.
R.