2019-07-19 Jeff Law <law@redhat.com>
+ PR tree-optimization/86061
* tree-ssa-dse.c (initialize_ao_ref_for_dse): Handle
strncpy. Drop some trivial dead code.
(maybe_trim_memstar_call): Handle strncpy.
+2019-07-23 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/86061
+ * gcc.dg/tree-ssa/pr86061.c: New test.
+
2019-07-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/83518
2019-07-19 Jeff Law <law@redhat.com>
+ PR tree-optimization/86061
* gcc.dg/tree-ssa/ssa-dse-37.c: New test.
* gcc.dg/tree-ssa/ssa-dse-38.c: New test.
--- /dev/null
+/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre" } */
+
+
+struct S { int i; char n[128]; int j; };
+
+void f (char*);
+
+void g (struct S *p)
+{
+ char a[sizeof p->n + 1];
+
+ __builtin_memset (a, 0, sizeof a); // dead store, can be eliminated
+
+ __builtin_strncpy (a, p->n, sizeof a - 1);
+ a[sizeof a - 1] = '\0';
+
+ f (a);
+}
+
+/* { dg-final { scan-tree-dump-times "Deleted dead call" 1 "dse1" } } */