summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/builtins.c2
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c3
-rw-r--r--gcc/cfgexpand.c2
-rw-r--r--gcc/config/aarch64/aarch64.c6
-rw-r--r--gcc/config/arm/arm.c6
-rw-r--r--gcc/config/mips/mips.c4
-rw-r--r--gcc/config/rs6000/rs6000.c6
-rw-r--r--gcc/dwarf2out.c3
-rw-r--r--gcc/godump.c3
-rw-r--r--gcc/omp-low.c3
-rw-r--r--gcc/stor-layout.c3
-rw-r--r--gcc/trans-mem.c2
-rw-r--r--gcc/tree-object-size.c6
-rw-r--r--gcc/tree-sra.c2
-rw-r--r--gcc/tree-ssa-forwprop.c4
-rw-r--r--gcc/tree-ssa-strlen.c11
-rw-r--r--gcc/tree-switch-conversion.c2
-rw-r--r--gcc/tree-vect-patterns.c3
-rw-r--r--gcc/tree.c8
-rw-r--r--gcc/tree.h4
-rw-r--r--gcc/tsan.c9
23 files changed, 69 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6768fec5b19..7220961ba60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,31 @@
2013-11-18 Richard Sandiford <rdsandiford@googlemail.com>
+ * tree.h (tree_to_uhwi): Return an unsigned HOST_WIDE_INT.
+ * tree.c (tree_to_uhwi): Return an unsigned HOST_WIDE_INT.
+ (tree_ctz): Remove cast to unsigned type.
+ * builtins.c (fold_builtin_memory_op): Likewise.
+ * dwarf2out.c (descr_info_loc): Likewise.
+ * godump.c (go_output_typedef): Likewise.
+ * omp-low.c (expand_omp_simd): Likewise.
+ * stor-layout.c (excess_unit_span): Likewise.
+ * tree-object-size.c (addr_object_size): Likewise.
+ * tree-sra.c (analyze_all_variable_accesses): Likewise.
+ * tree-ssa-forwprop.c (simplify_builtin_call): Likewise.
+ (simplify_rotate): Likewise.
+ * tree-ssa-strlen.c (adjust_last_stmt, handle_builtin_memcpy)
+ (handle_pointer_plus): Likewise.
+ * tree-switch-conversion.c (check_range): Likewise.
+ * tree-vect-patterns.c (vect_recog_rotate_pattern): Likewise.
+ * tsan.c (instrument_builtin_call): Likewise.
+ * cfgexpand.c (defer_stack_allocation): Add cast to HOST_WIDE_INT.
+ * trans-mem.c (tm_log_add): Likewise.
+ * config/aarch64/aarch64.c (aapcs_vfp_sub_candidate): Likewise.
+ * config/arm/arm.c (aapcs_vfp_sub_candidate): Likewise.
+ * config/rs6000/rs6000.c (rs6000_aggregate_candidate): Likewise.
+ * config/mips/mips.c (r10k_safe_mem_expr_p): Make offset unsigned.
+
+2013-11-18 Richard Sandiford <rdsandiford@googlemail.com>
+
* tree.h (host_integerp, tree_low_cst): Delete.
* tree.c (host_integerp, tree_low_cst): Delete.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1405868ec39..39d40cb75e7 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -8781,7 +8781,7 @@ fold_builtin_memory_op (location_t loc, tree dest, tree src,
if (readonly_data_expr (src)
|| (tree_fits_uhwi_p (len)
&& (MIN (src_align, dest_align) / BITS_PER_UNIT
- >= (unsigned HOST_WIDE_INT) tree_to_uhwi (len))))
+ >= tree_to_uhwi (len))))
{
tree fn = builtin_decl_implicit (BUILT_IN_MEMCPY);
if (!fn)
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 8aac23c700a..113b4edda79 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,10 @@
2013-11-18 Richard Sandiford <rdsandiford@googlemail.com>
+ * c-common.c (convert_vector_to_pointer_for_subscript): Remove
+ cast to unsigned type.
+
+2013-11-18 Richard Sandiford <rdsandiford@googlemail.com>
+
* c-common.c (fold_offsetof_1): Use tree_to_uhwi rather than
tree_low_cst.
(complete_array_type): Update comment to refer to tree_to_[su]hwi
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index fb8295dfdc5..83d6253cbfd 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -11702,8 +11702,7 @@ convert_vector_to_pointer_for_subscript (location_t loc,
if (TREE_CODE (index) == INTEGER_CST)
if (!tree_fits_uhwi_p (index)
- || ((unsigned HOST_WIDE_INT) tree_to_uhwi (index)
- >= TYPE_VECTOR_SUBPARTS (type)))
+ || tree_to_uhwi (index) >= TYPE_VECTOR_SUBPARTS (type))
warning_at (loc, OPT_Warray_bounds, "index value is out of bound");
c_common_mark_addressable_vec (*vecp);
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 7732b097ea7..85732c8f0d7 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1133,7 +1133,7 @@ defer_stack_allocation (tree var, bool toplevel)
/* Whether the variable is small enough for immediate allocation not to be
a problem with regard to the frame size. */
bool smallish
- = (tree_to_uhwi (DECL_SIZE_UNIT (var))
+ = ((HOST_WIDE_INT) tree_to_uhwi (DECL_SIZE_UNIT (var))
< PARAM_VALUE (PARAM_MIN_SIZE_FOR_STACK_SHARING));
/* If stack protection is enabled, *all* stack variables must be deferred,
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 3bc35935248..edd378ce69d 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6041,7 +6041,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -6071,7 +6071,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -6103,7 +6103,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 72ba2ed5548..3ee27b4b7be 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -4739,7 +4739,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -4769,7 +4769,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -4801,7 +4801,7 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index c2666317caa..80bbb00c2c8 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -14927,7 +14927,7 @@ r10k_safe_address_p (rtx x, rtx insn)
a link-time-constant address. */
static bool
-r10k_safe_mem_expr_p (tree expr, HOST_WIDE_INT offset)
+r10k_safe_mem_expr_p (tree expr, unsigned HOST_WIDE_INT offset)
{
HOST_WIDE_INT bitoffset, bitsize;
tree inner, var_offset;
@@ -14940,7 +14940,7 @@ r10k_safe_mem_expr_p (tree expr, HOST_WIDE_INT offset)
return false;
offset += bitoffset / BITS_PER_UNIT;
- return offset >= 0 && offset < tree_to_uhwi (DECL_SIZE_UNIT (inner));
+ return offset < tree_to_uhwi (DECL_SIZE_UNIT (inner));
}
/* A for_each_rtx callback for which DATA points to the instruction
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index cb6ce999a30..bfa061c8c6e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8564,7 +8564,7 @@ rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -8594,7 +8594,7 @@ rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
@@ -8626,7 +8626,7 @@ rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
/* There must be no padding. */
if (!tree_fits_uhwi_p (TYPE_SIZE (type))
- || (tree_to_uhwi (TYPE_SIZE (type))
+ || ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
!= count * GET_MODE_BITSIZE (*modep)))
return -1;
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4f7bcf4f79e..0095507ee1a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17073,8 +17073,7 @@ descr_info_loc (tree val, tree base_decl)
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
if (tree_fits_uhwi_p (TREE_OPERAND (val, 1))
- && (unsigned HOST_WIDE_INT) tree_to_uhwi (TREE_OPERAND (val, 1))
- < 16384)
+ && tree_to_uhwi (TREE_OPERAND (val, 1)) < 16384)
{
loc = descr_info_loc (TREE_OPERAND (val, 0), base_decl);
if (!loc)
diff --git a/gcc/godump.c b/gcc/godump.c
index 4c319c47737..3efbc7c988b 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -986,8 +986,7 @@ go_output_typedef (struct godump_container *container, tree decl)
tree_to_shwi (TREE_VALUE (element)));
else if (tree_fits_uhwi_p (TREE_VALUE (element)))
snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_UNSIGNED,
- ((unsigned HOST_WIDE_INT)
- tree_to_uhwi (TREE_VALUE (element))));
+ tree_to_uhwi (TREE_VALUE (element)));
else
snprintf (buf, sizeof buf, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
((unsigned HOST_WIDE_INT)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 4141dd9a6c0..f850f53e441 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -6770,8 +6770,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
{
safelen = OMP_CLAUSE_SAFELEN_EXPR (safelen);
if (!tree_fits_uhwi_p (safelen)
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (safelen)
- > INT_MAX)
+ || tree_to_uhwi (safelen) > INT_MAX)
loop->safelen = INT_MAX;
else
loop->safelen = tree_to_uhwi (safelen);
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 659bfbb5566..535b897f80c 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1053,8 +1053,7 @@ excess_unit_span (HOST_WIDE_INT byte_offset, HOST_WIDE_INT bit_offset,
offset = offset % align;
return ((offset + size + align - 1) / align
- > ((unsigned HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE (type))
- / align));
+ > tree_to_uhwi (TYPE_SIZE (type)) / align);
}
#endif
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index d3cc1ab5e81..879f37b9177 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -1104,7 +1104,7 @@ tm_log_add (basic_block entry_block, tree addr, gimple stmt)
&& transaction_invariant_address_p (lp->addr, entry_block)
&& TYPE_SIZE_UNIT (type) != NULL
&& tree_fits_uhwi_p (TYPE_SIZE_UNIT (type))
- && (tree_to_uhwi (TYPE_SIZE_UNIT (type))
+ && ((HOST_WIDE_INT) tree_to_uhwi (TYPE_SIZE_UNIT (type))
< PARAM_VALUE (PARAM_TM_MAX_AGGREGATE_SIZE))
/* We must be able to copy this type normally. I.e., no
special constructors and the like. */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index f3fb932de23..51a5d590a2c 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -210,15 +210,13 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
else if (pt_var
&& DECL_P (pt_var)
&& tree_fits_uhwi_p (DECL_SIZE_UNIT (pt_var))
- && (unsigned HOST_WIDE_INT)
- tree_to_uhwi (DECL_SIZE_UNIT (pt_var)) < offset_limit)
+ && tree_to_uhwi (DECL_SIZE_UNIT (pt_var)) < offset_limit)
pt_var_size = DECL_SIZE_UNIT (pt_var);
else if (pt_var
&& TREE_CODE (pt_var) == STRING_CST
&& TYPE_SIZE_UNIT (TREE_TYPE (pt_var))
&& tree_fits_uhwi_p (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)))
- && (unsigned HOST_WIDE_INT)
- tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)))
+ && tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)))
< offset_limit)
pt_var_size = TYPE_SIZE_UNIT (TREE_TYPE (pt_var));
else
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 1194d099650..b4b17882d2a 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2488,7 +2488,7 @@ analyze_all_variable_accesses (void)
if (TREE_CODE (var) == VAR_DECL
&& type_consists_of_records_p (TREE_TYPE (var)))
{
- if ((unsigned) tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
+ if (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (var)))
<= max_total_scalarization_size)
{
completely_scalarize_var (var);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 0a8d42561c4..817fa9f4614 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1601,7 +1601,7 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
as the new memcpy length, if it is too big, bail out. */
src_len = tree_to_uhwi (diff);
src_len += tree_to_uhwi (len2);
- if (src_len < (unsigned HOST_WIDE_INT) tree_to_uhwi (len1))
+ if (src_len < tree_to_uhwi (len1))
src_len = tree_to_uhwi (len1);
if (src_len > 1024)
break;
@@ -2319,7 +2319,7 @@ simplify_rotate (gimple_stmt_iterator *gsi)
/* CNT1 + CNT2 == B case above. */
if (tree_fits_uhwi_p (def_arg2[0])
&& tree_fits_uhwi_p (def_arg2[1])
- && (unsigned HOST_WIDE_INT) tree_to_uhwi (def_arg2[0])
+ && tree_to_uhwi (def_arg2[0])
+ tree_to_uhwi (def_arg2[1]) == TYPE_PRECISION (rtype))
rotcnt = def_arg2[0];
else if (TREE_CODE (def_arg2[0]) != SSA_NAME
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index bf2a5fb61d5..04e9ef4a0e2 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -850,12 +850,11 @@ adjust_last_stmt (strinfo si, gimple stmt, bool is_strcat)
{
if (!tree_fits_uhwi_p (last.len)
|| integer_zerop (len)
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (len)
- != (unsigned HOST_WIDE_INT) tree_to_uhwi (last.len) + 1)
+ || tree_to_uhwi (len) != tree_to_uhwi (last.len) + 1)
return;
/* Don't adjust the length if it is divisible by 4, it is more efficient
to store the extra '\0' in that case. */
- if ((((unsigned HOST_WIDE_INT) tree_to_uhwi (len)) & 3) == 0)
+ if ((tree_to_uhwi (len) & 3) == 0)
return;
}
else if (TREE_CODE (len) == SSA_NAME)
@@ -1337,8 +1336,7 @@ handle_builtin_memcpy (enum built_in_function bcode, gimple_stmt_iterator *gsi)
/* Handle memcpy (x, "abcd", 5) or
memcpy (x, "abc\0uvw", 7). */
if (!tree_fits_uhwi_p (len)
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (len)
- <= (unsigned HOST_WIDE_INT) ~idx)
+ || tree_to_uhwi (len) <= (unsigned HOST_WIDE_INT) ~idx)
return;
}
@@ -1627,8 +1625,7 @@ handle_pointer_plus (gimple_stmt_iterator *gsi)
{
tree off = gimple_assign_rhs2 (stmt);
if (tree_fits_uhwi_p (off)
- && (unsigned HOST_WIDE_INT) tree_to_uhwi (off)
- <= (unsigned HOST_WIDE_INT) ~idx)
+ && tree_to_uhwi (off) <= (unsigned HOST_WIDE_INT) ~idx)
ssa_ver_to_stridx[SSA_NAME_VERSION (lhs)]
= ~(~idx - (int) tree_to_uhwi (off));
return;
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index a4340a49a8b..fa31e22d525 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -701,7 +701,7 @@ check_range (struct switch_conv_info *info)
return false;
}
- if ((unsigned HOST_WIDE_INT) tree_to_uhwi (info->range_size)
+ if (tree_to_uhwi (info->range_size)
> ((unsigned) info->count * SWITCH_CONVERSION_BRANCH_RATIO))
{
info->reason = "the maximum range-branch ratio exceeded";
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index c186c9a5a96..0992fbc9c73 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -1636,8 +1636,7 @@ vect_recog_rotate_pattern (vec<gimple> *stmts, tree *type_in, tree *type_out)
if (TREE_CODE (def) == INTEGER_CST)
{
if (!tree_fits_uhwi_p (def)
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (def)
- >= GET_MODE_PRECISION (TYPE_MODE (type))
+ || tree_to_uhwi (def) >= GET_MODE_PRECISION (TYPE_MODE (type))
|| integer_zerop (def))
return NULL;
def2 = build_int_cst (stype,
diff --git a/gcc/tree.c b/gcc/tree.c
index 836db518b45..5e098b5e32e 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2211,8 +2211,7 @@ tree_ctz (const_tree expr)
case LSHIFT_EXPR:
ret1 = tree_ctz (TREE_OPERAND (expr, 0));
if (tree_fits_uhwi_p (TREE_OPERAND (expr, 1))
- && ((unsigned HOST_WIDE_INT) tree_to_uhwi (TREE_OPERAND (expr, 1))
- < (unsigned HOST_WIDE_INT) prec))
+ && (tree_to_uhwi (TREE_OPERAND (expr, 1)) < prec))
{
ret2 = tree_to_uhwi (TREE_OPERAND (expr, 1));
return MIN (ret1 + ret2, prec);
@@ -2220,8 +2219,7 @@ tree_ctz (const_tree expr)
return ret1;
case RSHIFT_EXPR:
if (tree_fits_uhwi_p (TREE_OPERAND (expr, 1))
- && ((unsigned HOST_WIDE_INT) tree_to_uhwi (TREE_OPERAND (expr, 1))
- < (unsigned HOST_WIDE_INT) prec))
+ && (tree_to_uhwi (TREE_OPERAND (expr, 1)) < prec))
{
ret1 = tree_ctz (TREE_OPERAND (expr, 0));
ret2 = tree_to_uhwi (TREE_OPERAND (expr, 1));
@@ -7011,7 +7009,7 @@ tree_to_shwi (const_tree t)
TYPE_UNSIGNED) fits in an unsigned HOST_WIDE_INT. Return that
HOST_WIDE_INT. */
-HOST_WIDE_INT
+unsigned HOST_WIDE_INT
tree_to_uhwi (const_tree t)
{
gcc_assert (tree_fits_uhwi_p (t));
diff --git a/gcc/tree.h b/gcc/tree.h
index 2ac3480fc6a..f63672c0897 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3668,7 +3668,7 @@ extern bool tree_fits_uhwi_p (const_tree)
#endif
;
extern HOST_WIDE_INT tree_to_shwi (const_tree);
-extern HOST_WIDE_INT tree_to_uhwi (const_tree);
+extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree);
#if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
tree_to_shwi (const_tree t)
@@ -3677,7 +3677,7 @@ tree_to_shwi (const_tree t)
return TREE_INT_CST_LOW (t);
}
-extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
+extern inline __attribute__ ((__gnu_inline__)) unsigned HOST_WIDE_INT
tree_to_uhwi (const_tree t)
{
gcc_assert (tree_fits_uhwi_p (t));
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 8aac468a444..b8f65af6541 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -448,8 +448,7 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
case fetch_op:
last_arg = gimple_call_arg (stmt, num - 1);
if (!tree_fits_uhwi_p (last_arg)
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (last_arg)
- > MEMMODEL_SEQ_CST)
+ || tree_to_uhwi (last_arg) > MEMMODEL_SEQ_CST)
return;
gimple_call_set_fndecl (stmt, decl);
update_stmt (stmt);
@@ -520,12 +519,10 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
for (j = 0; j < 6; j++)
args[j] = gimple_call_arg (stmt, j);
if (!tree_fits_uhwi_p (args[4])
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (args[4])
- > MEMMODEL_SEQ_CST)
+ || tree_to_uhwi (args[4]) > MEMMODEL_SEQ_CST)
return;
if (!tree_fits_uhwi_p (args[5])
- || (unsigned HOST_WIDE_INT) tree_to_uhwi (args[5])
- > MEMMODEL_SEQ_CST)
+ || tree_to_uhwi (args[5]) > MEMMODEL_SEQ_CST)
return;
update_gimple_call (gsi, decl, 5, args[0], args[1], args[2],
args[4], args[5]);