This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
jump bugfix
- To: gcc-patches at gcc dot gnu dot org
- Subject: jump bugfix
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 17 Apr 2001 20:38:50 -0700
compile/20010408-1.c is failing on some platforms and represents a
regression against gcc-2.95.x.
In simplest terms, we're deleting a label that is still referenced
by a jump. You might ask how that's possible since it clearly
shouldn't be happening.
We zap the label because we've got two labels which are not separated
by anything important. Block merging notices this and try to clean
things up and zaps our label in the process.
Of course that seems rather odd. Why do we have blocks like this?
Because we don't really build an accurate CFG when we build the CFG
for tail recursion -> tail jump optimizations. Specifically we don't
record the edge for the tail jump.
The flow code tries to account for this and not merge such blocks by
noting the label referenced by the CALL_PLACEHOLDER insn as the
tail recursion label and treating it special. So the flow code tries
to deal with this inaccuracy in the CFG and is failing. Why is it
failing?
It's failing because jump.c modifies the jump in the tail recursion
insn stream of the CALL_PLACEHOLDER, but doesn't fix up the label
referenced by the CALL_PLACEHOLDER itself. This patch fixes that
little goof, which in turn prevents our label from going away, which
in turn prevents the compiler from segfaulting. Wheeee.
This has been bootstrapped and tested with no regressions PA32 and PA64.
I'm installing it on the branch as well as in the mainline sources.
* jump.c (mark_all_labels): Canonicalize the tail recursion
label attached to CALL_PLACEHOLDER insns.
Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.153.2.1
diff -c -3 -p -r1.153.2.1 jump.c
*** jump.c 2001/02/16 18:24:49 1.153.2.1
--- jump.c 2001/04/18 03:35:11
*************** mark_all_labels (f, cross_jump)
*** 881,886 ****
--- 881,897 ----
mark_all_labels (XEXP (PATTERN (insn), 0), cross_jump);
mark_all_labels (XEXP (PATTERN (insn), 1), cross_jump);
mark_all_labels (XEXP (PATTERN (insn), 2), cross_jump);
+
+ /* Canonicalize the tail recursion label attached to the
+ CALL_PLACEHOLDER insn. */
+ if (XEXP (PATTERN (insn), 3))
+ {
+ rtx label_ref = gen_rtx_LABEL_REF (VOIDmode,
+ XEXP (PATTERN (insn), 3));
+ mark_jump_label (label_ref, insn, cross_jump, 0);
+ XEXP (PATTERN (insn), 3) = XEXP (label_ref, 0);
+ }
+
continue;
}