This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] pdp11: Fix bad code for no frame pointer case
- From: Paul Koning <paul_koning at dell dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 18 Nov 2010 21:04:33 -0500
- Subject: [PATCH] pdp11: Fix bad code for no frame pointer case
FIRST_PARM_OFFSET was set on the assumption that there is always a frame pointer saved in the stack frame, which is incorrect. This patch fixes that, which corrects testsuite failures caused by picking up function arguments at the wrong stack offset.
Tested by built, check of the failing testcase (abs-1.c). Committed.
paul
ChangeLog:
2010-11-18 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.h (FIRST_PARM_OFFSET): Fix case of no frame
pointer.
Index: config/pdp11/pdp11.h
===================================================================
--- config/pdp11/pdp11.h (revision 166927)
+++ config/pdp11/pdp11.h (working copy)
@@ -372,11 +372,10 @@
/* Offset of first parameter from the argument pointer register value.
For the pdp11, this is nonzero to account for the return address.
1 - return address
- 2 - frame pointer (always saved, even when not used!!!!)
- -- change some day !!!:q!
+ 2 - frame pointer, if needed
*/
-#define FIRST_PARM_OFFSET(FNDECL) 4
+#define FIRST_PARM_OFFSET(FNDECL) ((frame_pointer_needed) ? 4 : 2)
/* Define how to find the value returned by a function.
VALTYPE is the data type of the value (as a tree).