aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 67fe8ad..7ee7a09 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3767,8 +3767,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
of pointer PTROP and integer INTOP. */
tree
-pointer_int_sum (location_t location, enum tree_code resultcode,
- tree ptrop, tree intop)
+pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
{
tree size_exp, ret;
@@ -3777,19 +3776,19 @@ pointer_int_sum (location_t location, enum tree_code resultcode,
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer of type %<void *%> used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to a function used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to member function used in arithmetic");
size_exp = integer_one_node;
}
@@ -3852,31 +3851,6 @@ pointer_int_sum (location_t location, enum tree_code resultcode,
if (resultcode == MINUS_EXPR)
intop = fold_build1 (NEGATE_EXPR, sizetype, intop);
- if (TREE_CODE (intop) == INTEGER_CST)
- {
- tree offset_node;
- tree string_cst = string_constant (ptrop, &offset_node);
-
- if (string_cst != 0
- && !(offset_node && TREE_CODE (offset_node) != INTEGER_CST))
- {
- HOST_WIDE_INT max = TREE_STRING_LENGTH (string_cst);
- HOST_WIDE_INT offset;
- if (offset_node == 0)
- offset = 0;
- else if (! host_integerp (offset_node, 0))
- offset = -1;
- else
- offset = tree_low_cst (offset_node, 0);
-
- offset = offset + tree_low_cst (intop, 0);
- if (offset < 0 || offset > max)
- warning_at (location, 0,
- "offset %<%wd%> outside bounds of constant string",
- tree_low_cst (intop, 0));
- }
- }
-
ret = fold_build2 (POINTER_PLUS_EXPR, result_type, ptrop, intop);
fold_undefer_and_ignore_overflow_warnings ();