+2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For an
+ ADDR_EXPR, do not count the offset of a COMPONENT_REF twice.
+
2018-01-16 Kelvin Nilsen <kelvin@gcc.gnu.org>
* config/rs6000/rs6000-p8swap.c (rs6000_gen_stvx): Generate
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))
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
{
+2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-c++-common/Warray-bounds-3.c (test_memmove_bounds): Fix mismatch.
+
2018-01-16 Eric Botcazou <ebotcazou@adacore.com>
* c-c++-common/Wrestrict.c (test_strcpy_range): Bump string size of one
T (int, 2, a + SR ( 1, 3), pi, n);
T (int, 2, a + SR ( 2, 3), pi, n);
- T (int32_t, 2, a + SR ( 3, 4), pi, n); /* { dg-warning "offset \\\[12, 16] is out of the bounds \\\[0, 8] of object .\[^\n\r]+. with type .int32_t ?\\\[2]." } */
+ const int32_t *pi32 = (const int32_t*)s;
+ T (int32_t, 2, a + SR ( 3, 4), pi32, n); /* { dg-warning "offset \\\[12, 16] is out of the bounds \\\[0, 8] of object .\[^\n\r]+. with type .int32_t ?\\\[2]." } */
}