This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Prevent combine_instructions() from following non-existant LOG_LINKS
- To: gcc-patches at gcc dot gnu dot org
- Subject: Prevent combine_instructions() from following non-existant LOG_LINKS
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 26 Jan 2000 10:57:33 -0800
Hi Guys,
I ran into a problem with combine_instructions() when RTL checking
is enabled. Sometimes it can try to combine an insn which has been
deleted and the RTL checking code compainins about an attempt to
access the LOG_LINKS of a NOTE which is not supposed to have such a
field. (It does have one, because it once was an insn, but the RTL
checking code does not know this). The patch below fixes this small
problem by tetsing to see if the insn is a NOTE before LOG_LINKS is
called.
OK to apply this patch ?
Cheers
Nick
2000-01-25 Nick Clifton <nickc@redhat.com>
* combine.c (combine_instructions): Do not try to combine a
sequence of insns when the second insn has been replaced by a
note.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.112
diff -p -r1.112 combine.c
*** combine.c 2000/01/24 20:10:01 1.112
--- combine.c 2000/01/26 18:53:25
*************** combine_instructions (f, nregs)
*** 622,632 ****
/* Try each sequence of three linked insns ending with this one. */
for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! for (nextlinks = LOG_LINKS (XEXP (links, 0)); nextlinks;
! nextlinks = XEXP (nextlinks, 1))
! if ((next = try_combine (insn, XEXP (links, 0),
! XEXP (nextlinks, 0))) != 0)
! goto retry;
#ifdef HAVE_cc0
/* Try to combine a jump insn that uses CC0
--- 622,642 ----
/* Try each sequence of three linked insns ending with this one. */
for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! {
! rtx link = XEXP (links, 0);
!
! /* If the linked insn has been replaced by a note, then there
! is no point in persuing this chain any further. */
! if (GET_CODE (link) == NOTE)
! break;
!
! for (nextlinks = LOG_LINKS (link);
! nextlinks;
! nextlinks = XEXP (nextlinks, 1))
! if ((next = try_combine (insn, XEXP (links, 0),
! XEXP (nextlinks, 0))) != 0)
! goto retry;
! }
#ifdef HAVE_cc0
/* Try to combine a jump insn that uses CC0