This is the mail archive of the 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]

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


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.


2001-07-05  Stephane Carrez  <>

	* 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;
     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.  */
   ((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).  */

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