This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11807] Wrong usage of registers on ARM
- From: "rearnsha at arm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2003 17:51:07 -0000
- Subject: [Bug c++/11807] Wrong usage of registers on ARM
- References: <20030805124527.11807.aw11@os.inf.tu-dresden.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11807
------- Additional Comments From rearnsha at arm dot com 2003-08-05 17:51 -------
Subject: Re: Wrong usage of registers on ARM
> 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.