This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug c++/11807] 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]