Don't assert "alg != libcall" for -minline-stringops-dynamically
authorH.J. Lu <hongjiu.lu@intel.com>
Sat, 6 Dec 2014 11:32:46 +0000 (11:32 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Sat, 6 Dec 2014 11:32:46 +0000 (03:32 -0800)
gcc/

PR target/64200
* config/i386/i386.c (decide_alg): Don't assert "alg != libcall"
for TARGET_INLINE_STRINGOPS_DYNAMICALLY.

gcc/testsuite/

PR target/64200
* gcc.target/i386/memcpy-strategy-4.c: New test.

From-SVN: r218446

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c [new file with mode: 0644]

index f9fba3e6ce10d59609881f3315425afcbe63a891..b340b51fe488675497130351c63a39b37d4d8df9 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/64200
+       * config/i386/i386.c (decide_alg): Don't assert "alg != libcall"
+       for TARGET_INLINE_STRINGOPS_DYNAMICALLY.
+
 2014-12-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/64170
index 4f1a18b993a7ca5ea6c3cb0593794a20f456c090..aaf0b385c90da3f5a1570d97a3fb73b40af84e09 100644 (file)
@@ -24507,9 +24507,10 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
       alg = decide_alg (count, max / 2, min_size, max_size, memset,
                        zero_memset, dynamic_check, noalign);
       gcc_assert (*dynamic_check == -1);
-      gcc_assert (alg != libcall);
       if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
        *dynamic_check = max;
+      else
+       gcc_assert (alg != libcall);
       return alg;
     }
   return (alg_usable_p (algs->unknown_size, memset)
index b52905e34f8ef115240e86faa82898be3f5f9f25..4ea2dfe9dcfbce02ee9811004b41c4ab2d7ca5b2 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/64200
+       * gcc.target/i386/memcpy-strategy-4.c: New test.
+
 2014-12-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/64170
diff --git a/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c b/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c
new file mode 100644 (file)
index 0000000..5c51248
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/64200 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=atom -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically" } */
+
+#include <stdarg.h>
+
+extern void bar(char *x);
+
+void foo (int size, ...)
+{
+  struct
+  {
+    char x[size];
+  } d;
+
+  va_list ap;
+  va_start(ap, size);
+  d = va_arg(ap, typeof (d));
+  va_end(ap);
+  bar(d.x);
+}