This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc restores wrong stack pointer value?
- From: DJ Delorie <dj at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 18:55:50 -0500
- Subject: Re: gcc restores wrong stack pointer value?
- References: <201102252220.p1PMKBwm013803@greed.delorie.com> <4D6ED65C.9010000@redhat.com>
So... gcc assumes the register push/pops happen before the frame
pointer is initialized? So the epilog always restores $sp from $fp
before restoring registers?
That would make the m32c port much less efficient, since it has the
exitd opcode which restores $sp, releases the frame, and returns, all
in one.
But, why is it that gcc is *almost* doing what I expect? It *does*
save the $sp value, and restores it before the epilogue, but it
doesn't restore the value it has at the end of the prologue. I mean,
if only it copied $sp to $a1 *before* mucking with $sp, it would have
worked perfectly...