aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/builtins.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr59860.c15
4 files changed, 31 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 16fdb40..deac3c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/59860
+ * builtins.c (fold_builtin_strcat): Remove case better handled
+ by tree-ssa-strlen.c.
+
2014-01-20 Alan Lawrence <alan.lawrence@arm.com>
* config/aarch64/aarch64.opt
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 983cbc5..c597e44 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -11760,17 +11760,11 @@ fold_builtin_strcat (location_t loc ATTRIBUTE_UNUSED, tree dst, tree src)
if (!strlen_fn || !strcpy_fn)
return NULL_TREE;
- /* If we don't have a movstr we don't want to emit an strcpy
- call. We have to do that if the length of the source string
- isn't computable (in that case we can use memcpy probably
- later expanding to a sequence of mov instructions). If we
- have movstr instructions we can emit strcpy calls. */
- if (!HAVE_movstr)
- {
- tree len = c_strlen (src, 1);
- if (! len || TREE_SIDE_EFFECTS (len))
- return NULL_TREE;
- }
+ /* If the length of the source string isn't computable don't
+ split strcat into strlen and strcpy. */
+ tree len = c_strlen (src, 1);
+ if (! len || TREE_SIDE_EFFECTS (len))
+ return NULL_TREE;
/* Stabilize the argument list. */
dst = builtin_save_expr (dst);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e9f59ab..4c1f7e8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/59860
+ * gcc.dg/pr59860.c: New testcase.
+
2014-01-20 Jakub Jelinek <jakub@redhat.com>
PR target/59880
diff --git a/gcc/testsuite/gcc.dg/pr59860.c b/gcc/testsuite/gcc.dg/pr59860.c
new file mode 100644
index 0000000..6807d9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr59860.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) char * __attribute__ ((__nothrow__ , __leaf__))
+strcat (char *__restrict __dest, const char *__restrict __src)
+{
+ return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
+}
+static char raw_decode;
+void foo (char **argv, char *outfilename)
+{
+ if (**argv == 'r')
+ raw_decode = 1;
+ strcat (outfilename, raw_decode ? ".raw" : ".wav");
+}