aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-array-bounds.cc17
-rw-r--r--gcc/gimple-array-bounds.h6
2 files changed, 12 insertions, 11 deletions
diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc
index 8dfd6f9..598c76b 100644
--- a/gcc/gimple-array-bounds.cc
+++ b/gcc/gimple-array-bounds.cc
@@ -43,9 +43,9 @@ along with GCC; see the file COPYING3. If not see
// break the dependency on equivalences for this pass.
const value_range *
-array_bounds_checker::get_value_range (const_tree op)
+array_bounds_checker::get_value_range (const_tree op, gimple *stmt)
{
- return ranges->get_value_range (op);
+ return ranges->get_value_range (op, stmt);
}
/* Try to determine the DECL that REF refers to. Return the DECL or
@@ -173,7 +173,7 @@ trailing_array (tree arg, tree *pref)
bool
array_bounds_checker::check_array_ref (location_t location, tree ref,
- bool ignore_off_by_one)
+ gimple *stmt, bool ignore_off_by_one)
{
if (warning_suppressed_p (ref, OPT_Warray_bounds))
/* Return true to have the caller prevent warnings for enclosing
@@ -287,7 +287,7 @@ array_bounds_checker::check_array_ref (location_t location, tree ref,
const value_range *vr = NULL;
if (TREE_CODE (low_sub) == SSA_NAME)
{
- vr = get_value_range (low_sub);
+ vr = get_value_range (low_sub, stmt);
if (!vr->undefined_p () && !vr->varying_p ())
{
low_sub = vr->kind () == VR_RANGE ? vr->max () : vr->min ();
@@ -563,7 +563,8 @@ array_bounds_checker::check_mem_ref (location_t location, tree ref,
address of an ARRAY_REF, and call check_array_ref on it. */
void
-array_bounds_checker::check_addr_expr (location_t location, tree t)
+array_bounds_checker::check_addr_expr (location_t location, tree t,
+ gimple *stmt)
{
/* For the most significant subscript only, accept taking the address
of the just-past-the-end element. */
@@ -575,7 +576,7 @@ array_bounds_checker::check_addr_expr (location_t location, tree t)
bool warned = false;
if (TREE_CODE (t) == ARRAY_REF)
{
- warned = check_array_ref (location, t, ignore_off_by_one);
+ warned = check_array_ref (location, t, stmt, ignore_off_by_one);
ignore_off_by_one = false;
}
else if (TREE_CODE (t) == MEM_REF)
@@ -728,14 +729,14 @@ array_bounds_checker::check_array_bounds (tree *tp, int *walk_subtree,
bool warned = false;
array_bounds_checker *checker = (array_bounds_checker *) wi->info;
if (TREE_CODE (t) == ARRAY_REF)
- warned = checker->check_array_ref (location, t,
+ warned = checker->check_array_ref (location, t, wi->stmt,
false/*ignore_off_by_one*/);
else if (TREE_CODE (t) == MEM_REF)
warned = checker->check_mem_ref (location, t,
false /*ignore_off_by_one*/);
else if (TREE_CODE (t) == ADDR_EXPR)
{
- checker->check_addr_expr (location, t);
+ checker->check_addr_expr (location, t, wi->stmt);
*walk_subtree = false;
}
else if (inbounds_memaccess_p (t))
diff --git a/gcc/gimple-array-bounds.h b/gcc/gimple-array-bounds.h
index fa64262..d8f7ff7 100644
--- a/gcc/gimple-array-bounds.h
+++ b/gcc/gimple-array-bounds.h
@@ -31,10 +31,10 @@ public:
private:
static tree check_array_bounds (tree *tp, int *walk_subtree, void *data);
- bool check_array_ref (location_t, tree, bool ignore_off_by_one);
+ bool check_array_ref (location_t, tree, gimple *, bool ignore_off_by_one);
bool check_mem_ref (location_t, tree, bool ignore_off_by_one);
- void check_addr_expr (location_t, tree);
- const value_range *get_value_range (const_tree op);
+ void check_addr_expr (location_t, tree, gimple *);
+ const value_range *get_value_range (const_tree op, gimple *);
struct function *fun;
range_query *ranges;