From c7c816408314bd7e971543bfa91250d464e45540 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 6 Dec 2014 11:32:46 +0000 Subject: [PATCH] Don't assert "alg != libcall" for -minline-stringops-dynamically 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 | 6 ++++++ gcc/config/i386/i386.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ .../gcc.target/i386/memcpy-strategy-4.c | 21 +++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9fba3e6ce1..b340b51fe48 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-12-06 H.J. Lu + + PR target/64200 + * config/i386/i386.c (decide_alg): Don't assert "alg != libcall" + for TARGET_INLINE_STRINGOPS_DYNAMICALLY. + 2014-12-05 Jakub Jelinek PR sanitizer/64170 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4f1a18b993a..aaf0b385c90 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b52905e34f8..4ea2dfe9dcf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-06 H.J. Lu + + PR target/64200 + * gcc.target/i386/memcpy-strategy-4.c: New test. + 2014-12-05 Jakub Jelinek 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 index 00000000000..5c51248b5c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c @@ -0,0 +1,21 @@ +/* PR target/64200 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=atom -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically" } */ + +#include + +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); +} -- 2.30.2