This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
bug in flow.c
- To: gcc at gcc dot gnu dot org
- Subject: bug in flow.c
- From: Andrew Phillips <atp at pergamentum dot com>
- Date: Mon, 21 Aug 2000 06:20:54 -0600 (MDT)
Hi,
Looks like theres a tiny bug in the tidy_fallthru_edge() function
in flow.c, which causes an ICE. It seems that it is tripped
rarely (in my case, compiling the linux kernel serial.c for
the VAX.) Although the version used is 2.95.2, it looks like the
problem may still be present in the latest CVS snapshot.
in tidy_fallthru_edge()
If you have a small basic block such that NEXT_INSN(block->head)
== block->end and it contains a JUMP_INSN, with HAVE_cc0 defined
then during the deletion of the insn chain the insn pointed to by block->end
can be deleted, without the block->end pointer being updated.
Later in this pass, in merge_blocks() during the insn list
traversal, NEXT_INSN(b->end) is referenced causing a segfault and
ICE.
This small patch (to 2.95.2) fixes the problem.
Cheers,
Andy
--
Dr Andy Phillips atp@pergamentum.com
Pergamentum Solutions atp@coralcay.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
--- flow.c.orig Mon Jul 31 11:33:28 2000
+++ flow.c Mon Aug 7 12:22:16 2000
@@ -2530,6 +2530,9 @@
/* Selectively unlink the sequence. */
if (q != PREV_INSN (c->head))
+ /* check that we will not orphan b->end
+ * in the case of NEXT_INSN(b->head) == b->end. */
+ if (b->end == NEXT_INSN(q)) b->end = q;
flow_delete_insn_chain (NEXT_INSN (q), PREV_INSN (c->head));
e->flags |= EDGE_FALLTHRU;