[PATCH]: Fix builtin_return_address() with -fomit-frame-pointer (HC11)

Stephane Carrez Stephane.Carrez@worldnet.fr
Thu Jul 5 14:10:00 GMT 2001


Hi!

The definition I've defined for RETURN_ADDR_RTX was only correct
for programs with a frame.  When the frame is eliminated, the
elimination produced a wrong address (shifted by 2).  The patch
below fixes the definition for both frame and eliminated frame
case (HC11 & HC12). Tested with gcc.c-torture/execute/20010122-1.c.

I've committed this patch on 3_0 and 3_1.

	Stephane

2001-07-05  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* config/m68hc11/m68hc11.h (RETURN_ADDR_RTX): Fix return address
	when -fomit-frame-pointer is used.
Index: config/m68hc11/m68hc11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.14
diff -u -p -r1.14 m68hc11.h
--- m68hc11.h	2001/06/29 17:21:14	1.14
+++ m68hc11.h	2001/07/05 20:58:24
@@ -892,10 +892,10 @@ extern int m68hc11_sp_correction;
 #define INCOMING_RETURN_ADDR_RTX \
     gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
 
-/* After the prologue, RA is at -2(AP) in the current frame.  */
+/* After the prologue, RA is at 0(AP) in the current frame.  */
 #define RETURN_ADDR_RTX(COUNT, FRAME)					\
   ((COUNT) == 0								\
-   ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -2))\
+   ? gen_rtx_MEM (Pmode, arg_pointer_rtx)                               \
    : 0)
 
 /* Before the prologue, the top of the frame is at 2(sp).  */


More information about the Gcc-patches mailing list