public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3658] Fix middle-end/102395: reg_class having only NO_REGS and ALL_REGS.
@ 2021-09-19  3:49 Andrew Pinski
  0 siblings, 0 replies; only message in thread
From: Andrew Pinski @ 2021-09-19  3:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:767c098247a405041a48d6c1663100bfc29e414c

commit r12-3658-g767c098247a405041a48d6c1663100bfc29e414c
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sat Sep 18 08:20:16 2021 +0000

    Fix middle-end/102395: reg_class having only NO_REGS and ALL_REGS.
    
    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.

Diff:
---
 gcc/lra-constraints.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index a56080bee35..4d734548c38 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-19  3:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-19  3:49 [gcc r12-3658] Fix middle-end/102395: reg_class having only NO_REGS and ALL_REGS Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).