From 12b38cca4a25ca8dcda775ebdbcb57e4c622eb0b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 16 Jan 2018 23:11:10 +0000 Subject: 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 --- gcc/gimple-ssa-warn-restrict.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'gcc/gimple-ssa-warn-restrict.c') 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 { -- cgit v1.2.3