+2019-10-08 Martin Sebor <msebor@redhat.com>
+
+ PR c++/92001
+ * call.c (maybe_warn_class_memaccess): Handle arrays.
+
2019-10-07 Paolo Carlini <paolo.carlini@oracle.com>
* call.c (resolve_args): Use cp_expr_loc_or_input_loc in one place.
unsigned srcidx = !dstidx;
tree dest = (*args)[dstidx];
- if (!TREE_TYPE (dest) || !INDIRECT_TYPE_P (TREE_TYPE (dest)))
+ if (!TREE_TYPE (dest)
+ || (TREE_CODE (TREE_TYPE (dest)) != ARRAY_TYPE
+ && !INDIRECT_TYPE_P (TREE_TYPE (dest))))
return;
tree srctype = NULL_TREE;
+2019-10-08 Martin Sebor <msebor@redhat.com>
+
+ PR c++/92001
+ * g++.dg/Wclass-memaccess-5.C: New test.
+
2019-10-08 Dmitrij Pochepko <dmitrij.pochepko@bell-sw.com>
PR tree-optimization/90836
--- /dev/null
+/* PR c++/92001 - missing -Wclass-memaccess with array as first argument
+ to memset
+ { dg-do compile }
+ { dg-options "-Wall" } */
+
+extern "C" void* memset (void*, int, __SIZE_TYPE__);
+
+struct S { S (); };
+
+void test_array_access (S *p, S (*pa)[2], S (&r)[3])
+{
+ S a[1];
+ memset (a, 0, sizeof a); // { dg-warning "-Wclass-memaccess" }
+
+ memset (*pa, 0, sizeof *pa); // { dg-warning "-Wclass-memaccess" }
+
+ memset (r, 0, sizeof r); // { dg-warning "-Wclass-memaccess" }
+}