This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
regrename.c sanity check.
- From: Tom Rix <trix at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 30 Apr 2002 14:24:39 -0500
- Subject: regrename.c sanity check.
This patch checks the returns of preprocess_constraints calls in
regrename.c
For a broken port, an ICE is preferable to a segfault on the access of
recog_op_alt.
Ok to commit?
Tom
--
Tom Rix
GCC Engineer
trix@redhat.com
2002-04-30 Tom Rix <trix@redhat.com>
* regrename.c (build_def_use, copyprop_hardreg_forward_1): Sanity
check which_alternative.
Index: gcc/regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.46
diff -d -u -p -r1.46 regrename.c
--- gcc/regrename.c 25 Mar 2002 12:51:46 -0000 1.46
+++ gcc/regrename.c 30 Apr 2002 17:55:35 -0000
@@ -788,6 +788,10 @@ build_def_use (bb)
extract_insn (insn);
constrain_operands (1);
preprocess_constraints ();
+
+ if (which_alternative == -1)
+ fatal_insn_not_found (insn);
+
alt = which_alternative;
n_ops = recog_data.n_operands;
@@ -1548,6 +1552,10 @@ copyprop_hardreg_forward_1 (bb, vd)
extract_insn (insn);
constrain_operands (1);
preprocess_constraints ();
+
+ if (which_alternative == -1)
+ fatal_insn_not_found (insn);
+
alt = which_alternative;
n_ops = recog_data.n_operands;
is_asm = asm_noperands (PATTERN (insn)) >= 0;