diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-01-16 23:11:10 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2018-01-16 23:11:10 +0000 |
commit | 12b38cca4a25ca8dcda775ebdbcb57e4c622eb0b (patch) | |
tree | b35c60a150370db2798b69a8e8ebc0a4b3109841 /gcc/gimple-ssa-warn-restrict.c | |
parent | 035181c3129648328176cbdee69d2a7a66e0a895 (diff) |
gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For an ADDR_EXPR, do not count the offset of a COMPONENT_REF twice.
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For an
ADDR_EXPR, do not count the offset of a COMPONENT_REF twice.
From-SVN: r256766
Diffstat (limited to 'gcc/gimple-ssa-warn-restrict.c')
-rw-r--r-- | gcc/gimple-ssa-warn-restrict.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index 6979403a4f4..d3e4e5242a4 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -312,11 +312,11 @@ builtin_memref::builtin_memref (tree expr, tree size) if (TREE_CODE (expr) == ADDR_EXPR) { poly_int64 off; - tree oper = TREE_OPERAND (expr, 0); + tree op = TREE_OPERAND (expr, 0); /* Determine the base object or pointer of the reference and its constant offset from the beginning of the base. */ - base = get_addr_base_and_unit_offset (oper, &off); + base = get_addr_base_and_unit_offset (op, &off); HOST_WIDE_INT const_off; if (base && off.is_constant (&const_off)) @@ -325,17 +325,11 @@ builtin_memref::builtin_memref (tree expr, tree size) offrange[1] += const_off; /* Stash the reference for offset validation. */ - ref = oper; + ref = op; /* Also stash the constant offset for offset validation. */ - tree_code code = TREE_CODE (oper); - if (code == COMPONENT_REF) - { - tree field = TREE_OPERAND (ref, 1); - tree fldoff = DECL_FIELD_OFFSET (field); - if (TREE_CODE (fldoff) == INTEGER_CST) - refoff = const_off + wi::to_offset (fldoff); - } + if (TREE_CODE (op) == COMPONENT_REF) + refoff = const_off; } else { |