[lkml]   [2011]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/4] msm: scm: Fix improper register assignment

On Sat, 2011-02-26 at 20:04 +0000, Nicolas Pitre wrote:
> Right. A minimal test case may look like this if someone feels like
> filling a gcc bug report:
> extern int foo(int x);
> int bar(int x)
> {
> register int a asm("r0") = 1;
> x = foo(x);
> asm ("add %0, %1, %2" : "=r" (x) : "r" (a), "r" (x));
> return x;
> }
> And the produced code is:
> bar:
> stmfd sp!, {r3, lr}
> bl foo
> #APP
> add r0, r0, r0
> ldmfd sp!, {r3, pc}
> So this is clearly bogus.

I've had a chat with the compiler guys and they confirmed that this is a
known bug. There's a really hairy bug report here:

It looks like the GCC stance will change in the future so that register
variables will only be guaranteed to live in the specified register
during asm blocks which use them. If the register is required elsewhere,
spill/reload code will be emitted as necessary. This might break some
weird and wonderful code (passing hidden operands to functions?) but I
don't think we rely on the current behaviour anywhere in the kernel.


 \ /
  Last update: 2011-03-01 14:57    [W:0.114 / U:0.460 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site