aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bbcf237..cce6315 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3516,7 +3516,6 @@ vrp_prop::check_array_ref (location_t location, tree ref,
tree ptrdiff_max = TYPE_MAX_VALUE (ptrdiff_type_node);
tree maxbound = ptrdiff_max;
tree arg = TREE_OPERAND (ref, 0);
- poly_int64 off;
const bool compref = TREE_CODE (arg) == COMPONENT_REF;
if (compref)
@@ -3535,19 +3534,22 @@ vrp_prop::check_array_ref (location_t location, tree ref,
size wouldn't necessarily be correct if the reference is
to its flexible array member initialized in a different
translation unit. */
- tree base = get_addr_base_and_unit_offset (arg, &off);
- if (!compref && base && DECL_P (base))
- if (tree basesize = DECL_SIZE_UNIT (base))
- if (TREE_CODE (basesize) == INTEGER_CST)
- {
- maxbound = basesize;
- decl = base;
- }
-
- if (known_gt (off, 0))
- maxbound = wide_int_to_tree (sizetype,
- wi::sub (wi::to_wide (maxbound),
- off));
+ poly_int64 off;
+ if (tree base = get_addr_base_and_unit_offset (arg, &off))
+ {
+ if (!compref && DECL_P (base))
+ if (tree basesize = DECL_SIZE_UNIT (base))
+ if (TREE_CODE (basesize) == INTEGER_CST)
+ {
+ maxbound = basesize;
+ decl = base;
+ }
+
+ if (known_gt (off, 0))
+ maxbound = wide_int_to_tree (sizetype,
+ wi::sub (wi::to_wide (maxbound),
+ off));
+ }
}
else
maxbound = fold_convert (sizetype, maxbound);