Nested functions on ARM (mk II)

Richard Earnshaw rearnsha@arm.com
Wed Nov 15 03:22:00 GMT 2000


nickc@redhat.com said:
> 	str	ip, [sp, #-4]!
> 	add	ip, sp, #4
> 	stmfd	sp!, {r4, fp, ip, lr, pc}
> 	sub	fp, ip, #4
> 	ldr	ip, [fp, #4] 


This sequence is wrong.  You can't leave a hole in the stack like that.

1) As richard has pointed out, it upsets the elimination offsets.

2) The return sequence won't adjust for it when the frame pointer is 
eliminated.

It is possible to push a stack frame without using ip even for functions 
that use varargs, but the sequence is quite ugly (read inefficient).

Finally, have you checked that this compatible with dwarf unwind tables 
(ok, so those still aren't working properly, after the last round of 
changes to dwarf2out.c).

R.



More information about the Gcc-bugs mailing list