From a12cf6504261855228d6e8862344edb5ada5cff6 Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Fri, 7 Jul 2000 13:48:38 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/final.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b94eb01958..71e99330c0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 7 07:47:35 2000 Jeffrey A Law (law@cygnus.com) + + * final.c (final): Detect out of bounds array access to + the insn_lengths array. + 2000-07-07 Kazu Hirata * fold-const.c (fold): Fix a comment typo. diff --git a/gcc/final.c b/gcc/final.c index 35782db678d..3537bcf431a 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); -- 2.30.2