This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Fix non-local goto and setjmp/longjmp for HC11
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH: Fix non-local goto and setjmp/longjmp for HC11
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Sat, 07 Jul 2001 18:49:44 +0200
Hi!
For HC11 port, the non-local goto and builtin setjmp/longjmp didn't worked
because the frame pointer was not restored correctly. When the jump was
made, the frame was modified by +1 from its original value. This was due
to the `STARTING_FRAME_OFFSET' which is set to +1 in the case of 68hc11
(and 0 for HC12 which works).
The patch below uses the value 0 for both HC11/HC12. The elimination offsets
is changed between FRAME_POINTER -> HARD_FRAME_POINTER, STACK_POINTER to take
into account this.
Checked with gcc.c-torture/execute/comp-goto-2.c, 920501-7.c, built-in-setjmp.c.
I've integrated this patch in 3_0 and 3_1.
Stephane
2001-07-07 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.c (m68hc11_initial_elimination_offset):
Take into account m68hc11_sp_correction for FRAME_POINTER_REGNUM
elimination.
* config/m68hc11/m68hc11.h (STARTING_FRAME_OFFSET): Use 0.
Index: config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.16
diff -u -p -r1.16 m68hc11.c
--- m68hc11.c 2001/07/07 01:07:20 1.16
+++ m68hc11.c 2001/07/07 16:37:01
@@ -1231,7 +1231,7 @@ m68hc11_initial_elimination_offset (from
if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
{
- return 0;
+ return m68hc11_sp_correction;
}
/* Push any 2 byte pseudo hard registers that we need to save. */
@@ -1250,7 +1250,7 @@ m68hc11_initial_elimination_offset (from
if (from == FRAME_POINTER_REGNUM && to == HARD_SP_REGNUM)
{
- return size - m68hc11_sp_correction;
+ return size;
}
return 0;
}
Index: config/m68hc11/m68hc11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.16
diff -u -p -r1.16 m68hc11.h
--- m68hc11.h 2001/07/06 18:40:13 1.16
+++ m68hc11.h 2001/07/07 16:37:09
@@ -875,8 +875,7 @@ extern enum reg_class m68hc11_tmp_regs_c
If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
first local allocated. Otherwise, it is the offset to the BEGINNING
of the first local allocated. */
-extern int m68hc11_sp_correction;
-#define STARTING_FRAME_OFFSET m68hc11_sp_correction
+#define STARTING_FRAME_OFFSET 0
/* Offset of first parameter from the argument pointer register value. */