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 sibcall related failure in g++.old-deja/g++.other/eh1.C


Hi!

This patch fixes g++.old-deja/g++.other/eh1.C crash (and PR c++/318).
Basically what's going on is:
If thisblock->data.block.last_unconditional_cleanup points to last_insn
before we start_sequence for the normal or tail call sequence and
expand_decl_cleanup appends code to it, then last_insn is not up-to-date
at the point we want to emit the CALL_PLACEHOLDER or normal_insns chain and
thus emit_insns/emit_insn throws away all the cleanup stuff.
Ok to commit?

2000-06-16  Jakub Jelinek  <jakub@redhat.com>

	* calls.c (expand_call): Update last_insn if necessary before
	emitting CALL_PLACEHOLDER or normal_insns.

--- gcc/calls.c.jj	Mon Jun 12 09:55:36 2000
+++ gcc/calls.c	Fri Jun 16 16:25:16 2000
@@ -3255,6 +3255,17 @@ expand_call (exp, target, ignore)
 	&& GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
       replace_call_placeholder (insn, sibcall_use_normal);
 
+  /* EH might append instructions to last_unconditional_cleanup,
+     so last_insn might have changed.  Update it now.  */
+  insn = get_last_insn ();
+  if (insn && NEXT_INSN (insn))
+    {
+      do
+	insn = NEXT_INSN (insn);
+      while (NEXT_INSN (insn));
+      set_last_insn (insn);
+    }
+
   /* If this was a potential tail recursion site, then emit a
      CALL_PLACEHOLDER with the normal and the tail recursion streams.
      One of them will be selected later.  */

	Jakub

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