]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix middle-end/102395: reg_class having only NO_REGS and ALL_REGS.
authorAndrew Pinski <apinski@marvell.com>
Sat, 18 Sep 2021 08:20:16 +0000 (08:20 +0000)
committerAndrew Pinski <apinski@marvell.com>
Sun, 19 Sep 2021 03:49:13 +0000 (03:49 +0000)
So this is a simple fix is to just add to the assert that
sclass and dclass are both greater than or equal to NO_REGS.
NO_REGS is documented as the first register class so it should
have the value of 0.

gcc/ChangeLog:

* lra-constraints.c (check_and_process_move): Assert
that dclass and sclass are greater than or equal to NO_REGS.

gcc/lra-constraints.c

index a56080bee35ab0ff30ed260bac8f391acb7b91c7..4d734548c3879076dd158ffec736b336f0e83847 100644 (file)
@@ -1276,7 +1276,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p ATTRIBUTE_UNUSED)
   sclass = dclass = NO_REGS;
   if (REG_P (dreg))
     dclass = get_reg_class (REGNO (dreg));
-  gcc_assert (dclass < LIM_REG_CLASSES);
+  gcc_assert (dclass < LIM_REG_CLASSES && dclass >= NO_REGS);
   if (dclass == ALL_REGS)
     /* ALL_REGS is used for new pseudos created by transformations
        like reload of SUBREG_REG (see function
@@ -1288,7 +1288,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p ATTRIBUTE_UNUSED)
     return false;
   if (REG_P (sreg))
     sclass = get_reg_class (REGNO (sreg));
-  gcc_assert (sclass < LIM_REG_CLASSES);
+  gcc_assert (sclass < LIM_REG_CLASSES && sclass >= NO_REGS);
   if (sclass == ALL_REGS)
     /* See comments above.  */
     return false;