http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50106
--- Comment #4 from Sebastian Huber <sebastian.hu...@embedded-brains.de> 2011-08-22 09:43:39 UTC --- Yes, this patch fixes the problem. It is still not clear to me why we save the volatile registers r0, r1, and r2 at all. Also we restore r1, r2, and r3. Does this make sense? I think also the the usage of memcpy() is not justified in this case. _Z7_GetIDSj: .fnstart .LFB0: .save {r0, r1, r2, lr} push {r0, r1, r2, lr} ldr r1, .L4 cmp r0, #3 bhi .L2 lsl r0, r0, #1 add r1, r1, r0 .L2: mov r2, #2 add r0, sp, #4 bl memcpy add r3, sp, #4 ldrb r0, [r3, #1] ldrb r2, [r3] lsl r0, r0, #8 orr r0, r2 @ sp needed for prologue pop {r1, r2, r3, pc}