aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>2000-07-07 13:48:38 +0000
committerJeff Law <law@gcc.gnu.org>2000-07-07 07:48:38 -0600
commita12cf6504261855228d6e8862344edb5ada5cff6 (patch)
treeb1bdc06a5eae8438f378956855ec53b3144a0e20 /gcc/final.c
parent3abaac67a1d89738843ef44495d057228f485ad9 (diff)
downloadgcc-a12cf6504261855228d6e8862344edb5ada5cff6.zip
gcc-a12cf6504261855228d6e8862344edb5ada5cff6.tar.gz
gcc-a12cf6504261855228d6e8862344edb5ada5cff6.tar.bz2
final.c (final): Detect out of bounds array access to the insn_lengths array.
* final.c (final): Detect out of bounds array access to the insn_lengths array. From-SVN: r34901
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 35782db..3537bcf 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2014,6 +2014,12 @@ final (first, file, optimize, prescan)
for (insn = NEXT_INSN (first); insn;)
{
#ifdef HAVE_ATTR_length
+#ifdef ENABLE_CHECKING
+ /* This can be triggered by bugs elsewhere in the compiler if
+ new insns are created after init_insn_lengths is called. */
+ if (INSN_UID (insn) >= insn_lengths_max_uid)
+ abort ();
+#endif
insn_current_address = insn_addresses[INSN_UID (insn)];
#endif
insn = final_scan_insn (insn, file, optimize, prescan, 0);