This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix segfaults in split_all_insns
- To: gcc-patches at gcc dot gnu dot org
- Subject: Fix segfaults in split_all_insns
- From: Bernd Schmidt <bernds at redhat dot co dot uk>
- Date: Mon, 30 Oct 2000 13:21:13 +0000 (GMT)
A recent change to split_all_insns broke the ia64 port. In ia64.md, there
are a couple of splitters that don't return any new insns at all (e.g.
extendsfdf2). In that case, the loop to call cleanup_subreg_operand gets
confused and walks past the end of the function.
I also noticed that cleanup_subreg_operands wouldn't get run when we split
the last insn in a basic block.
Bernd
* recog.c (split_all_insns): Don't try to call cleanup_subreg_operands
if the splitter didn't emit new insns.
Make sure we call cleanup_subreg_operands even when splitting the last
insn in a basic block.
Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.81
diff -u -p -r1.81 recog.c
--- recog.c 2000/10/28 21:43:29 1.81
+++ recog.c 2000/10/30 13:18:11
@@ -2747,29 +2747,31 @@ split_all_insns (upd_life)
changed = 1;
/* try_split returns the NOTE that INSN became. */
- first = NEXT_INSN (first);
PUT_CODE (insn, NOTE);
NOTE_SOURCE_FILE (insn) = 0;
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ /* ??? Coddle to md files that generate subregs in post-
+ reload splitters instead of computing the proper
+ hard register. */
+ if (reload_completed && first != last)
+ {
+ first = NEXT_INSN (first);
+ while (1)
+ {
+ if (INSN_P (first))
+ cleanup_subreg_operands (first);
+ if (first == last)
+ break;
+ first = NEXT_INSN (first);
+ }
+ }
+
if (insn == bb->end)
{
bb->end = last;
break;
}
-
- /* ??? Coddle to md files that generate subregs in post-
- reload splitters instead of computing the proper
- hard register. */
- if (reload_completed)
- while (1)
- {
- if (INSN_P (first))
- cleanup_subreg_operands (first);
- if (first == last)
- break;
- first = NEXT_INSN (first);
- }
}
}