Patch to fix PR93561

Message ID 782fd9b2-f2f1-e4b4-9161-909a18d84176@redhat.com
State New
Headers show
Series
  • Patch to fix PR93561
Related show

Commit Message

Vladimir Makarov Feb. 6, 2020, 10:16 p.m.
The following patch fixes

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93561

The patch was successfully bootstrapped on x86-64.

Comments

Segher Boessenkool Feb. 7, 2020, 9:46 p.m. | #1
Hi!

On Thu, Feb 06, 2020 at 05:16:14PM -0500, Vladimir Makarov wrote:
> --- 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 (!HARD_REGISTER_NUM_P (hard_regno + j))
?


Segher

Patch

commit d26f37a16e3ed3d75a93ffb1da10c44c36a8a36d (HEAD -> master)
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  <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
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]));