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

[patch] Fix execute/20010122.c on h8300.


Hi,

Attached is a patch to fix the failure of execute/20010122.c on h8300
port.

If -fomit-frame-pointer is enabled, __builtin_return_address (1) or
above does not work because the frame pointer is gone.

The patch defines RETURN_ADDR_RTX so that it generates an rtx for a
return address only when COUNT is 0, which is the only safe case.

Tested on both the mainline and branch.  OK to apply?

Thanks,

Kazu Hirata

2001-08-29  Kazu Hirata  <kazu@hxi.com>

	* h8300.h (RETURN_ADDR_RTX): New.

Index: h8300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.h,v
retrieving revision 1.52
diff -u -r1.52 h8300.h
--- h8300.h	2001/08/10 14:06:14	1.52
+++ h8300.h	2001/08/29 15:00:15
@@ -495,6 +495,15 @@
 
 #define STARTING_FRAME_OFFSET 0
 
+/* We do not know if the caller has a frame pointer, so we cannot go
+   beyond level 0.  */
+
+#define RETURN_ADDR_RTX(COUNT, FRAME)					   \
+  ((COUNT) == 0								   \
+   ? gen_rtx_MEM (Pmode,						   \
+		  plus_constant (arg_pointer_rtx, -GET_MODE_SIZE (Pmode))) \
+   : 0)
+
 /* If we generate an insn to push BYTES bytes,
    this says how many the stack pointer really advances by.
 


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