This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix a 3.0.x regression with __builtin_setjmp
- To: rth at redhat dot com
- Subject: [PATCH] Fix a 3.0.x regression with __builtin_setjmp
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Mon, 29 Oct 2001 14:22:14 +0100
- Cc: gcc-patches at gcc dot gnu dot org
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
The following testcase ICEs in 3.0.x (and 2.96-RH) while it worked in
2.95.x. The bug went away with Jan's jump pass on cfg on the trunk.
The problem is that merge_blocks (actually merge_blocks_nomove) deletes a
builtin setjmp handler label.
Following patch fixes this, alternatively:
http://gcc.gnu.org/ml/gcc-patches/2001-07/msg01190.html
plus
if (GET_CODE (c->head) == CODE_LABEL
- && tail_recursion_label_p (c->head))
+ && (tail_recursion_label_p (c->head) || LABEL_PRESERVE_P (c->head)))
at start of merge_blocks fixes this too.
Ok to commit the testcase trunk/branch? Ok to commit merge_blocks change to
branch?
2001-10-29 Jakub Jelinek <jakub@redhat.com>
* flow.c (merge_blocks): Don't merge blocks if second block is
nonlocal_goto handler.
* gcc.c-torture/compile/20011029-1.c: New test.
--- gcc/testsuite/gcc.c-torture/compile/20011029-1.c.jj Mon Oct 29 14:25:09 2001
+++ gcc/testsuite/gcc.c-torture/compile/20011029-1.c Mon Oct 29 10:26:19 2001
@@ -0,0 +1,9 @@
+void foo (void *) __attribute__ ((noreturn));
+
+void
+bar (void *x)
+{
+ if (__builtin_setjmp (x))
+ return;
+ foo (x);
+}
--- gcc/flow.c.jj Wed Oct 24 21:25:18 2001
+++ gcc/flow.c Mon Oct 29 14:24:08 2001
@@ -2358,13 +2358,22 @@ merge_blocks (e, b, c)
edge e;
basic_block b, c;
{
- /* If C has a tail recursion label, do not merge. There is no
- edge recorded from the call_placeholder back to this label, as
- that would make optimize_sibling_and_tail_recursive_calls more
- complex for no gain. */
- if (GET_CODE (c->head) == CODE_LABEL
- && tail_recursion_label_p (c->head))
- return 0;
+ if (GET_CODE (c->head) == CODE_LABEL)
+ {
+ rtx x;
+
+ /* If C has a tail recursion label, do not merge. There is no
+ edge recorded from the call_placeholder back to this label, as
+ that would make optimize_sibling_and_tail_recursive_calls more
+ complex for no gain. */
+ if (tail_recursion_label_p (c->head))
+ return 0;
+
+ /* If C has a nonlocal goto label, do not merge either. */
+ for (x = nonlocal_goto_handler_labels; x; x = XEXP (x, 1))
+ if (XEXP (x, 0) == c->head)
+ return 0;
+ }
/* If B has a fallthru edge to C, no need to move anything. */
if (e->flags & EDGE_FALLTHRU)
Jakub