re PR tree-optimization/59860 (ICE in compute_may_aliases, at tree-ssa-structalias...
authorRichard Biener <rguenther@suse.de>
Mon, 20 Jan 2014 11:01:53 +0000 (11:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 20 Jan 2014 11:01:53 +0000 (11:01 +0000)
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.

* gcc.dg/pr59860.c: New testcase.

From-SVN: r206799

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr59860.c [new file with mode: 0644]

index 16fdb404989cb83286d4ca159ee0b3fc8fd9647d..deac3c39d4ee4245bd2e55ad17225374dfd0ea4b 100644 (file)
@@ -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
index 983cbc5b9e7439bebb1e2e8cbedb792ef00ace56..c597e44e58cff2789b6cc7130096efc66881674f 100644 (file)
@@ -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);
index e9f59abf675ebf206a23cf67d3b3e186f03a16c0..4c1f7e824dbd299edaf85cba3fc85b0fbd62571b 100644 (file)
@@ -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 (file)
index 0000000..6807d9c
--- /dev/null
@@ -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");
+}