Hi Guys,

  I am applying the patch below to fix the REGNO_REG_CLASS macro for
  the MCore backend so that it will not try to index beyond the end of
  the regno_reg_class array.  This was causing a segmentation fault
  whilst building the MCore toolchain.

Cheers
  Nick

gcc/ChangeLog
2011-04-27  Nick Clifton  <ni...@redhat.com>

        * config/mcore/mcore.h (REGNO_REG_CLASS): Do not index beyond the
        end of the regno_reg_class array.

Index: gcc/config/mcore/mcore.h
===================================================================
--- gcc/config/mcore/mcore.h    (revision 173012)
+++ gcc/config/mcore/mcore.h    (working copy)
@@ -357,7 +357,7 @@
    or could index an array.  */
 
 extern const enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
-#define REGNO_REG_CLASS(REGNO) regno_reg_class[REGNO]
+#define REGNO_REG_CLASS(REGNO) ((REGNO) < FIRST_PSEUDO_REGISTER ? 
regno_reg_class[REGNO] : NO_REGS)
 
 /* When this hook returns true for MODE, the compiler allows
    registers explicitly used in the rtl to be used as spill registers

Reply via email to