summaryrefslogtreecommitdiff
path: root/gcc/genattrtab.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-12-19 22:27:51 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2013-12-19 22:27:51 +0100
commite15eb172b0dd7451f121c908a97ab86a45759993 (patch)
tree0dd1c959d5fa1a9b4256002c3671f2654e454c31 /gcc/genattrtab.c
parentd8d79c1df220d94f4c285e0a6e1e750bfb488d78 (diff)
re PR other/59545 (Signed integer overflow issues)
PR other/59545 * genattrtab.c (struct attr_hash): Change hashcode type to unsigned. (attr_hash_add_rtx, attr_hash_add_string): Change hashcode parameter to unsigned. (attr_rtx_1): Change hashcode variable to unsigned. (attr_string): Likewise. Perform first multiplication in unsigned type. * ifcvt.c (noce_try_store_flag_constants): Avoid signed integer overflows. * double-int.c (neg_double): Likewise. * stor-layout.c (set_min_and_max_values_for_integral_type): Likewise. * combine.c (force_to_mode): Likewise. * postreload.c (move2add_use_add2_insn, move2add_use_add3_insn, reload_cse_move2add, move2add_note_store): Likewise. * simplify-rtx.c (simplify_const_unary_operation, simplify_const_binary_operation): Likewise. * ipa-split.c (find_split_points): Initialize first.can_split and first.non_ssa_vars. * gengtype-state.c (read_state_files_list): Fix up check. * genautomata.c (reserv_sets_hash_value): Use portable rotation idiom. java/ * class.c (hashUtf8String): Compute hash in unsigned type. * javaop.h (WORD_TO_INT): Avoid signed integer overflow. From-SVN: r206134
Diffstat (limited to 'gcc/genattrtab.c')
-rw-r--r--gcc/genattrtab.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index c0125d103b7..70f35316404 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -320,7 +320,7 @@ static FILE *attr_file, *dfa_file, *latency_file;
struct attr_hash
{
struct attr_hash *next; /* Next structure in the bucket. */
- int hashcode; /* Hash code of this rtx or string. */
+ unsigned int hashcode; /* Hash code of this rtx or string. */
union
{
char *str; /* The string (negative hash codes) */
@@ -345,7 +345,7 @@ static struct attr_hash *attr_hash_table[RTL_HASH_SIZE];
/* Add an entry to the hash table for RTL with hash code HASHCODE. */
static void
-attr_hash_add_rtx (int hashcode, rtx rtl)
+attr_hash_add_rtx (unsigned int hashcode, rtx rtl)
{
struct attr_hash *h;
@@ -359,7 +359,7 @@ attr_hash_add_rtx (int hashcode, rtx rtl)
/* Add an entry to the hash table for STRING with hash code HASHCODE. */
static void
-attr_hash_add_string (int hashcode, char *str)
+attr_hash_add_string (unsigned int hashcode, char *str)
{
struct attr_hash *h;
@@ -384,7 +384,7 @@ static rtx
attr_rtx_1 (enum rtx_code code, va_list p)
{
rtx rt_val = NULL_RTX;/* RTX to return to caller... */
- int hashcode;
+ unsigned int hashcode;
struct attr_hash *h;
struct obstack *old_obstack = rtl_obstack;
@@ -612,15 +612,15 @@ static char *
attr_string (const char *str, int len)
{
struct attr_hash *h;
- int hashcode;
+ unsigned int hashcode;
int i;
char *new_str;
/* Compute the hash code. */
- hashcode = (len + 1) * 613 + (unsigned) str[0];
+ hashcode = (len + 1) * 613U + (unsigned) str[0];
for (i = 1; i < len; i += 2)
hashcode = ((hashcode * 613) + (unsigned) str[i]);
- if (hashcode < 0)
+ if ((int) hashcode < 0)
hashcode = -hashcode;
/* Search the table for the string. */