------- Comment #4 from ramana at gcc dot gnu dot org 2009-07-28 12:09 ------- (In reply to comment #3) > (In reply to comment #2) > > The point made is correct but there is something you've missed in your > > patch ! > > loading lr with the address of the function you want to call, destroys the > > return address ,- so your code is never going to return ! > > > > Instead you want - > > > > ldr r3,[r3] > > blx r3 > > > > Or better still bx r3 but that is PR19599 :) > > blx sets the link register to the correct return address as a part of the > instruction, and the return address of the calling function has to already > have > been saved before this point or the mov lr, pc would destroy it already.
Oops yes, you are right - I must have been asleep ! . I would rather split the load out as a separate insn and allow it to be scheduled separately. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40887