summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog24
-rw-r--r--gcc/combine.c4
-rw-r--r--gcc/double-int.c2
-rw-r--r--gcc/genattrtab.c14
-rw-r--r--gcc/genautomata.c2
-rw-r--r--gcc/gengtype-state.c2
-rw-r--r--gcc/ifcvt.c7
-rw-r--r--gcc/ipa-split.c2
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/class.c2
-rw-r--r--gcc/java/javaop.h2
-rw-r--r--gcc/postreload.c12
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/stor-layout.c4
14 files changed, 61 insertions, 30 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bc32092b8cd..c2cc196d82d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,27 @@
+2013-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2013-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/neon-docgen.ml: Add crypto intrinsics documentation.
diff --git a/gcc/combine.c b/gcc/combine.c
index dea6c2818bb..ed1dac9d053 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8200,9 +8200,7 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask,
/* If X is (minus C Y) where C's least set bit is larger than any bit
in the mask, then we may replace with (neg Y). */
if (CONST_INT_P (XEXP (x, 0))
- && (((unsigned HOST_WIDE_INT) (INTVAL (XEXP (x, 0))
- & -INTVAL (XEXP (x, 0))))
- > mask))
+ && ((UINTVAL (XEXP (x, 0)) & -UINTVAL (XEXP (x, 0))) > mask))
{
x = simplify_gen_unary (NEG, GET_MODE (x), XEXP (x, 1),
GET_MODE (x));
diff --git a/gcc/double-int.c b/gcc/double-int.c
index 3803a63e3a9..a810a050e57 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -138,7 +138,7 @@ neg_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
if (l1 == 0)
{
*lv = 0;
- *hv = - h1;
+ *hv = - (unsigned HOST_WIDE_INT) h1;
return (*hv & h1) < 0;
}
else
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. */
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 5580c69a352..372ba90efc8 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -3494,7 +3494,7 @@ reserv_sets_hash_value (reserv_sets_t reservs)
{
reservs_num--;
hash_value += ((*reserv_ptr >> i)
- | (*reserv_ptr << (sizeof (set_el_t) * CHAR_BIT - i)));
+ | (*reserv_ptr << ((sizeof (set_el_t) * CHAR_BIT) & -i)));
i++;
if (i == sizeof (set_el_t) * CHAR_BIT)
i = 0;
diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
index fda473a2dbe..ef7713ff06a 100644
--- a/gcc/gengtype-state.c
+++ b/gcc/gengtype-state.c
@@ -2651,7 +2651,7 @@ read_state_files_list (void)
"expecting file in !fileslist of state file");
};
t0 = peek_state_token (0);
- if (!state_token_kind (t0) == STOK_RIGHTPAR)
+ if (state_token_kind (t0) != STOK_RIGHTPAR)
fatal_reading_state (t0, "missing ) for !fileslist in state file");
next_state_tokens (1);
}
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 569b9bf46c4..db5b8a23eb8 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1112,12 +1112,13 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
ifalse = INTVAL (if_info->a);
itrue = INTVAL (if_info->b);
+ diff = (unsigned HOST_WIDE_INT) itrue - ifalse;
/* Make sure we can represent the difference between the two values. */
- if ((itrue - ifalse > 0)
+ if ((diff > 0)
!= ((ifalse < 0) != (itrue < 0) ? ifalse < 0 : ifalse < itrue))
return FALSE;
- diff = trunc_int_for_mode (itrue - ifalse, mode);
+ diff = trunc_int_for_mode (diff, mode);
can_reverse = (reversed_comparison_code (if_info->cond, if_info->jump)
!= UNKNOWN);
@@ -1148,7 +1149,7 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
if (reversep)
{
tmp = itrue; itrue = ifalse; ifalse = tmp;
- diff = trunc_int_for_mode (-diff, mode);
+ diff = trunc_int_for_mode (-(unsigned HOST_WIDE_INT) diff, mode);
}
start_sequence ();
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 43758b6db7a..40c8fd6f99b 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -950,7 +950,9 @@ find_split_points (int overall_time, int overall_size)
first.earliest = INT_MAX;
first.set_ssa_names = 0;
first.used_ssa_names = 0;
+ first.non_ssa_vars = 0;
first.bbs_visited = 0;
+ first.can_split = false;
stack.safe_push (first);
ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux = (void *)(intptr_t)-1;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 3b8a95a6baf..5ab19210cb7 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR other/59545
+ * class.c (hashUtf8String): Compute hash in unsigned type.
+ * javaop.h (WORD_TO_INT): Avoid signed integer overflow.
+
2013-11-22 Andrew MacLeod <amacleod@redhat.com>
* java-gimplify.c: Add required include files from gimple.h.
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 532c9c1d94f..e5d2e6d8e8c 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -920,7 +920,7 @@ hashUtf8String (const char *str, int len)
{
const unsigned char* ptr = (const unsigned char*) str;
const unsigned char *limit = ptr + len;
- int32 hash = 0;
+ uint32 hash = 0;
for (; ptr < limit;)
{
int ch = UTF8_GET (ptr, limit);
diff --git a/gcc/java/javaop.h b/gcc/java/javaop.h
index 574c10c7992..bffa857cc3e 100644
--- a/gcc/java/javaop.h
+++ b/gcc/java/javaop.h
@@ -154,7 +154,7 @@ WORD_TO_INT(jword w)
{
jint n = w & 0xffffffff; /* Mask lower 32 bits. */
n ^= (jint)1 << 31;
- n -= (jint)1 << 31; /* Sign extend lower 32 bits to upper. */
+ n -= (uint32)1 << 31; /* Sign extend lower 32 bits to upper. */
return n;
}
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 37bd9ff6ae3..478a552608f 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1766,7 +1766,7 @@ move2add_use_add2_insn (rtx reg, rtx sym, rtx off, rtx insn)
rtx pat = PATTERN (insn);
rtx src = SET_SRC (pat);
int regno = REGNO (reg);
- rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[regno],
+ rtx new_src = gen_int_mode (UINTVAL (off) - reg_offset[regno],
GET_MODE (reg));
bool speed = optimize_bb_for_speed_p (BLOCK_FOR_INSN (insn));
bool changed = false;
@@ -1866,7 +1866,7 @@ move2add_use_add3_insn (rtx reg, rtx sym, rtx off, rtx insn)
&& reg_symbol_ref[i] != NULL_RTX
&& rtx_equal_p (sym, reg_symbol_ref[i]))
{
- rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[i],
+ rtx new_src = gen_int_mode (UINTVAL (off) - reg_offset[i],
GET_MODE (reg));
/* (set (reg) (plus (reg) (const_int 0))) is not canonical;
use (set (reg) (reg)) instead.
@@ -1901,7 +1901,7 @@ move2add_use_add3_insn (rtx reg, rtx sym, rtx off, rtx insn)
tem = gen_rtx_REG (GET_MODE (reg), min_regno);
if (i != min_regno)
{
- rtx new_src = gen_int_mode (INTVAL (off) - reg_offset[min_regno],
+ rtx new_src = gen_int_mode (UINTVAL (off) - reg_offset[min_regno],
GET_MODE (reg));
tem = gen_rtx_PLUS (GET_MODE (reg), tem, new_src);
}
@@ -2010,7 +2010,7 @@ reload_cse_move2add (rtx first)
&& CONST_INT_P (XEXP (SET_SRC (set), 1)))
{
rtx src3 = XEXP (SET_SRC (set), 1);
- HOST_WIDE_INT added_offset = INTVAL (src3);
+ unsigned HOST_WIDE_INT added_offset = UINTVAL (src3);
HOST_WIDE_INT base_offset = reg_offset[REGNO (src)];
HOST_WIDE_INT regno_offset = reg_offset[regno];
rtx new_src =
@@ -2224,7 +2224,7 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
{
rtx src = SET_SRC (set);
rtx base_reg;
- HOST_WIDE_INT offset;
+ unsigned HOST_WIDE_INT offset;
int base_regno;
switch (GET_CODE (src))
@@ -2235,7 +2235,7 @@ move2add_note_store (rtx dst, const_rtx set, void *data)
base_reg = XEXP (src, 0);
if (CONST_INT_P (XEXP (src, 1)))
- offset = INTVAL (XEXP (src, 1));
+ offset = UINTVAL (XEXP (src, 1));
else if (REG_P (XEXP (src, 1))
&& move2add_valid_value_p (REGNO (XEXP (src, 1)), mode))
{
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 78cd665e9a8..3019fd86112 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1647,7 +1647,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
break;
case NEG:
- val = - arg0;
+ val = - (unsigned HOST_WIDE_INT) arg0;
break;
case ABS:
@@ -4117,15 +4117,15 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
switch (code)
{
case PLUS:
- val = arg0s + arg1s;
+ val = (unsigned HOST_WIDE_INT) arg0s + arg1s;
break;
case MINUS:
- val = arg0s - arg1s;
+ val = (unsigned HOST_WIDE_INT) arg0s - arg1s;
break;
case MULT:
- val = arg0s * arg1s;
+ val = (unsigned HOST_WIDE_INT) arg0s * arg1s;
break;
case DIV:
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 9325525dd9f..675a12386eb 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2521,7 +2521,7 @@ set_min_and_max_values_for_integral_type (tree type,
max_value
= build_int_cst_wide (type, precision - HOST_BITS_PER_WIDE_INT >= 0
? -1
- : ((HOST_WIDE_INT) 1 << precision) - 1,
+ : (HOST_WIDE_INT_1U << precision) - 1,
precision - HOST_BITS_PER_WIDE_INT > 0
? ((unsigned HOST_WIDE_INT) ~0
>> (HOST_BITS_PER_WIDE_INT
@@ -2534,7 +2534,7 @@ set_min_and_max_values_for_integral_type (tree type,
= build_int_cst_wide (type,
(precision - HOST_BITS_PER_WIDE_INT > 0
? 0
- : (HOST_WIDE_INT) (-1) << (precision - 1)),
+ : HOST_WIDE_INT_M1U << (precision - 1)),
(((HOST_WIDE_INT) (-1)
<< (precision - HOST_BITS_PER_WIDE_INT - 1 > 0
? precision - HOST_BITS_PER_WIDE_INT - 1