From d26f37a16e3ed3d75a93ffb1da10c44c36a8a36d Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Thu, 6 Feb 2020 17:10:58 -0500 Subject: [PATCH] PR93561 -- [bounds checking] memory overflow for spill_for 2020-02-06 Vladimir Makarov PR rtl-optimization/93561 * lra-assigns.c (spill_for): Check that tested hard regno is not out of hard register range. --- gcc/ChangeLog | 7 +++++++ gcc/lra-assigns.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1754aa76399..aec58a06529 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2020-02-06 + Vladimir Makarov + + PR rtl-optimization/93561 + * lra-assigns.c (spill_for): Check that tested hard regno is not out of + hard register range. + 2020-02-06 Richard Sandiford * config/aarch64/aarch64.md (aarch64_movk): Add a type diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 031ce402c32..40e323c2a64 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -964,6 +964,8 @@ spill_for (int regno, bitmap spilled_pseudo_bitmap, bool first_p) bitmap_clear (&spill_pseudos_bitmap); for (j = hard_regno_nregs (hard_regno, mode) - 1; j >= 0; j--) { + if (hard_regno + j >= FIRST_PSEUDO_REGISTER) + break; if (try_hard_reg_pseudos_check[hard_regno + j] != curr_pseudo_check) continue; lra_assert (!bitmap_empty_p (&try_hard_reg_pseudos[hard_regno + j])); -- 2.30.2