PR93561 -- [bounds checking] memory overflow for spill_for
authorVladimir N. Makarov <vmakarov@redhat.com>
Thu, 6 Feb 2020 22:10:58 +0000 (17:10 -0500)
committerVladimir N. Makarov <vmakarov@redhat.com>
Thu, 6 Feb 2020 22:10:58 +0000 (17:10 -0500)
2020-02-06  <zhongyunde@huawei.com>
       Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/93561
* lra-assigns.c (spill_for): Check that tested hard regno is not out of
hard register range.

gcc/ChangeLog
gcc/lra-assigns.c

index 1754aa763999c9bcaa2211fe092e550de4a83425..aec58a06529f0113802abd1c4797164551de6d38 100644 (file)
@@ -1,3 +1,10 @@
+2020-02-06  <zhongyunde@huawei.com>
+           Vladimir Makarov  <vmakarov@redhat.com>
+
+       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  <richard.sandiford@arm.com>
 
        * config/aarch64/aarch64.md (aarch64_movk<mode>): Add a type
index 031ce402c32fdad1bd9244f62b7e85ef14ea6829..40e323c2a6476c18e9a3a754bef012ce6ab17a95 100644 (file)
@@ -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]));