------- Comment #1 from gilles dot chanteperdrix at xenomai dot org 2009-01-12
18:03 -------
The following code:
__thread long tl = 42;
long f(void)
{
long *l = &tl;
register long r0 __asm__ ("r0");
register long *r1 __asm__ ("r1");
r0 = 23;
r1 = l;
__asm__ __volatile__ ("": "+r"(r0) : "r"(r1));
return r0;
}
When compiled with -O2, gives the followin assembly code:
f:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r1, .L3
str lr, [sp, #-4]!
bl __aeabi_read_tp @ load_tp_soft
add r1, r0, r1
ldr pc, [sp], #4
Where we see that the r0 register is never loaded with 23 as it should.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38815