This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc restores wrong stack pointer value?



m32c-elf, gcc.dg/torture/stackalign/nested-1 at -O0,
produces this code:

_bar.1229:
	enter	#0
	pushm	r1,r2,r3,a0,a1
	; end of prologue
	mov.l	a0,r3r1
	add.l	#-66,sp
	stc	sp,a1
. . .
	ldc	a1,sp
	; start of epilogue
	popm	r1,r2,r3,a0,a1
	exitd

Note that the $sp restored just before the epilogue is NOT the value
of $sp at the end of the prologue, so the wrong registers get popped.
(the exitd works because it uses the frame pointer).
EXIT_IGNORE_STACK is set to 0.

Is this expected behavior?  Do I need to do some magic in my epilogue
to further "fix" the stack pointer?

Note: the add.l is not part of the prologue; the "end of prologue"
comment is a volatile unspec; the pushm is the last thing emitted by
the prolog function.  The '#0' on the enter is the stack adjustment
the prologue does.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]