2017-04-29 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/80487
gcc/
* tree-ssa-alias.c (stmt_kills_ref_p): Handle stpncpy and strncpy.
gcc/testsuite/
* gcc.dg/tree-ssa/strncpy-1.c: New file.
From-SVN: r247408
+2017-04-29 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/80487
+ * tree-ssa-alias.c (stmt_kills_ref_p): Handle stpncpy and strncpy.
+
2017-04-29 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR tree-optimization/79697
+2017-04-29 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/80487
+ * gcc.dg/tree-ssa/strncpy-1.c: New file.
+
2017-04-29 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR tree-optimization/79697
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+void sink (void*);
+
+void f (const char *s)
+{
+ char a[256];
+
+ __builtin_memset (a, 0, sizeof a); // redundant memset
+ __builtin_strncpy (a, s, sizeof a);
+
+ sink (a);
+}
+
+/* { dg-final { scan-tree-dump-not "memset" "optimized" } } */
case BUILT_IN_MEMPCPY_CHK:
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
+ case BUILT_IN_STRNCPY:
+ case BUILT_IN_STPNCPY:
{
/* For a must-alias check we need to be able to constrain
the access properly. */