diff options
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index a0f4c3d2f3a..41a1beb2f2f 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -4971,7 +4971,7 @@ insert_range_assertions (void) IGNORE_OFF_BY_ONE is true if the ARRAY_REF is inside a ADDR_EXPR. */ static void -check_array_ref (tree ref, location_t location, bool ignore_off_by_one) +check_array_ref (location_t location, tree ref, bool ignore_off_by_one) { value_range_t* vr = NULL; tree low_sub, up_sub; @@ -5067,7 +5067,7 @@ search_for_addr_array (tree t, location_t location) do { if (TREE_CODE (t) == ARRAY_REF) - check_array_ref (t, location, true /*ignore_off_by_one*/); + check_array_ref (location, t, true /*ignore_off_by_one*/); t = TREE_OPERAND (t, 0); } @@ -5085,16 +5085,24 @@ check_array_bounds (tree *tp, int *walk_subtree, void *data) { tree t = *tp; struct walk_stmt_info *wi = (struct walk_stmt_info *) data; - const location_t *location = (const location_t *) wi->info; + location_t location; + + if (EXPR_HAS_LOCATION (t)) + location = EXPR_LOCATION (t); + else + { + location_t *locp = (location_t *) wi->info; + location = *locp; + } *walk_subtree = TRUE; if (TREE_CODE (t) == ARRAY_REF) - check_array_ref (t, *location, false /*ignore_off_by_one*/); + check_array_ref (location, t, false /*ignore_off_by_one*/); if (TREE_CODE (t) == INDIRECT_REF || (TREE_CODE (t) == RETURN_EXPR && TREE_OPERAND (t, 0))) - search_for_addr_array (TREE_OPERAND (t, 0), *location); + search_for_addr_array (TREE_OPERAND (t, 0), location); if (TREE_CODE (t) == ADDR_EXPR) *walk_subtree = FALSE; |