--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstringop-overflow -fno-vect-cost-model" } */
+
+struct windowpos
+{
+ int hwnd;
+ int hwnd2;
+};
+
+struct packed_windowpos
+{
+ int hwnd;
+ int pad1;
+ int hwnd2;
+ int pad2;
+};
+
+struct packed_structs
+{
+ struct packed_windowpos wp;
+};
+
+void func(struct packed_structs *ps)
+{
+ struct windowpos wp;
+
+ wp.hwnd = ps->wp.hwnd;
+ wp.hwnd2 = ps->wp.hwnd2;
+ __builtin_memcpy(&ps->wp, &wp, sizeof(wp)); /* { dg-bogus "into a region" } */
+}
if (loop_vinfo)
addr_base = fold_build_pointer_plus (data_ref_base, base_offset);
else
- {
- addr_base = build1 (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (DR_REF (dr))),
- unshare_expr (DR_REF (dr)));
- }
+ addr_base = build1 (ADDR_EXPR,
+ build_pointer_type (TREE_TYPE (DR_REF (dr))),
+ /* Strip zero offset components since we don't need
+ them and they can confuse late diagnostics if
+ we CSE them wrongly. See PR106904 for example. */
+ unshare_expr (strip_zero_offset_components
+ (DR_REF (dr))));
vect_ptr_type = build_pointer_type (TREE_TYPE (DR_REF (dr)));
dest = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var, base_name);
return op;
}
+/* Strip handled components with zero offset from OP. */
+
+tree
+strip_zero_offset_components (tree op)
+{
+ while (TREE_CODE (op) == COMPONENT_REF
+ && integer_zerop (DECL_FIELD_OFFSET (TREE_OPERAND (op, 1)))
+ && integer_zerop (DECL_FIELD_BIT_OFFSET (TREE_OPERAND (op, 1))))
+ op = TREE_OPERAND (op, 0);
+ return op;
+}
+
static GTY(()) tree gcc_eh_personality_decl;
/* Return the GCC personality function decl. */
extern tree tree_strip_nop_conversions (tree);
extern tree tree_strip_sign_nop_conversions (tree);
extern const_tree strip_invariant_refs (const_tree);
+extern tree strip_zero_offset_components (tree);
extern tree lhd_gcc_personality (void);
extern void assign_assembler_name_if_needed (tree);
extern bool warn_deprecated_use (tree, tree);