Commit 089e575b by Richard Stallman

(int_reg_class_contents): Make unsigned to avoid signed integer overflow.

(init_reg_sets): Avoid signed integer overflow.

From-SVN: r3411
parent b670485b
...@@ -115,14 +115,14 @@ int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER; ...@@ -115,14 +115,14 @@ int reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER;
HARD_REG_SET reg_class_contents[N_REG_CLASSES]; HARD_REG_SET reg_class_contents[N_REG_CLASSES];
/* The same information, but as an array of ints. We copy from these /* The same information, but as an array of unsigned ints. We copy from
ints to the table above. This is done so that the tm.h files do these unsigned ints to the table above. We do this so the tm.h files
not have to be aware of the wordsize for machines with <= 64 regs. */ do not have to be aware of the wordsize for machines with <= 64 regs. */
#define N_REG_INTS \ #define N_REG_INTS \
((FIRST_PSEUDO_REGISTER + (HOST_BITS_PER_INT - 1)) / HOST_BITS_PER_INT) ((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; = REG_CLASS_CONTENTS;
/* For each reg class, number of regs it contains. */ /* For each reg class, number of regs it contains. */
...@@ -201,7 +201,7 @@ init_reg_sets () ...@@ -201,7 +201,7 @@ init_reg_sets ()
for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
if (int_reg_class_contents[i][j / HOST_BITS_PER_INT] 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); SET_HARD_REG_BIT (reg_class_contents[i], j);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment