OSDN Git Service

(int_reg_class_contents): Make unsigned to avoid signed integer overflow.
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Feb 1993 22:25:11 +0000 (22:25 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Feb 1993 22:25:11 +0000 (22:25 +0000)
(init_reg_sets): Avoid signed integer overflow.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@3411 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/regclass.c

index 5501a8c..80d008a 100644 (file)
@@ -115,14 +115,14 @@ int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER;
 
 HARD_REG_SET reg_class_contents[N_REG_CLASSES];
 
-/* The same information, but as an array of ints.  We copy from these
-   ints to the table above.  This is done so that the tm.h files do
-   not have to be aware of the wordsize for machines with <= 64 regs.  */
+/* The same information, but as an array of unsigned ints.  We copy from
+   these unsigned ints to the table above.  We do this so the tm.h files
+   do not have to be aware of the wordsize for machines with <= 64 regs.  */
 
 #define N_REG_INTS  \
   ((FIRST_PSEUDO_REGISTER + (HOST_BITS_PER_INT - 1)) / HOST_BITS_PER_INT)
 
-static int int_reg_class_contents[N_REG_CLASSES][N_REG_INTS] 
+static unsigned int_reg_class_contents[N_REG_CLASSES][N_REG_INTS] 
   = REG_CLASS_CONTENTS;
 
 /* For each reg class, number of regs it contains.  */
@@ -201,7 +201,7 @@ init_reg_sets ()
 
       for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
        if (int_reg_class_contents[i][j / HOST_BITS_PER_INT]
-           & (1 << (j % HOST_BITS_PER_INT)))
+           & ((unsigned) 1 << (j % HOST_BITS_PER_INT)))
          SET_HARD_REG_BIT (reg_class_contents[i], j);
     }