aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-02-22 22:34:07 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-02-22 22:34:07 +0100
commitf93bc53213faeaec9fc4a07bd4e6fb360f9d241d (patch)
tree62acd1a73c8d21cb374843f8b731238857b2ebab
parent78250306ccc6a32aa473beab781457e2161db607 (diff)
downloadgcc-f93bc53213faeaec9fc4a07bd4e6fb360f9d241d.zip
gcc-f93bc53213faeaec9fc4a07bd4e6fb360f9d241d.tar.gz
gcc-f93bc53213faeaec9fc4a07bd4e6fb360f9d241d.tar.bz2
re PR target/69888 (ICE: SIGSEGV in decide_alg (i386.c:26169) due to infinite (?) recursion with -minline-all-stringops -mmemset-strategy=no_stringop:-1:noalign)
PR target/69888 * config/i386/i386.c (decide_alg): Ensure we don't recurse with identical arguments. Formatting and spelling fixes. * gcc.target/i386/pr69888.c: New test. From-SVN: r233614
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/i386/i386.c21
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr69888.c10
4 files changed, 30 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fea6798..1266d58 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2016-02-22 Jakub Jelinek <jakub@redhat.com>
+ PR target/69888
+ * config/i386/i386.c (decide_alg): Ensure we don't recurse with
+ identical arguments. Formatting and spelling fixes.
+
PR target/69885
* doc/md.texi (ashl@var{m}3): Document that mode of operand 2 must
be specified.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a1c87ab..5c034f2 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -26032,11 +26032,12 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
bool memset, bool zero_memset, bool have_as,
int *dynamic_check, bool *noalign)
{
- const struct stringop_algs * algs;
+ const struct stringop_algs *algs;
bool optimize_for_speed;
int max = 0;
const struct processor_costs *cost;
int i;
+ HOST_WIDE_INT orig_expected_size = expected_size;
bool any_alg_usable_p = false;
*noalign = false;
@@ -26066,7 +26067,7 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
any_alg_usable_p |= usable;
if (candidate != libcall && candidate && usable)
- max = algs->size[i].max;
+ max = algs->size[i].max;
}
/* If expected size is not known but max size is small enough
@@ -26076,7 +26077,7 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
&& expected_size == -1)
expected_size = min_size / 2 + max_size / 2;
- /* If user specified the algorithm, honnor it if possible. */
+ /* If user specified the algorithm, honor it if possible. */
if (ix86_stringop_alg != no_stringop
&& alg_usable_p (ix86_stringop_alg, memset, have_as))
return ix86_stringop_alg;
@@ -26152,20 +26153,20 @@ decide_alg (HOST_WIDE_INT count, HOST_WIDE_INT expected_size,
|| !alg_usable_p (algs->unknown_size, memset, have_as)))
{
enum stringop_alg alg;
+ HOST_WIDE_INT new_expected_size = max > 0 ? max / 2 : 2048;
- /* If there aren't any usable algorithms, then recursing on
- smaller sizes isn't going to find anything. Just return the
- simple byte-at-a-time copy loop. */
- if (!any_alg_usable_p)
+ /* If there aren't any usable algorithms or if recursing with the
+ same arguments as before, then recursing on smaller sizes or
+ same size isn't going to find anything. Just return the simple
+ byte-at-a-time copy loop. */
+ if (!any_alg_usable_p || orig_expected_size == new_expected_size)
{
/* Pick something reasonable. */
if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
*dynamic_check = 128;
return loop_1_byte;
}
- if (max <= 0)
- max = 4096;
- alg = decide_alg (count, max / 2, min_size, max_size, memset,
+ alg = decide_alg (count, new_expected_size, min_size, max_size, memset,
zero_memset, have_as, dynamic_check, noalign);
gcc_assert (*dynamic_check == -1);
if (TARGET_INLINE_STRINGOPS_DYNAMICALLY)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02a3b3e..a9529af 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/69888
+ * gcc.target/i386/pr69888.c: New test.
+
2016-02-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/69882
diff --git a/gcc/testsuite/gcc.target/i386/pr69888.c b/gcc/testsuite/gcc.target/i386/pr69888.c
new file mode 100644
index 0000000..498fe5a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr69888.c
@@ -0,0 +1,10 @@
+/* PR target/69888 */
+/* { dg-do compile } */
+/* { dg-options "-minline-all-stringops -mmemset-strategy=no_stringop:-1:noalign" } */
+/* { dg-additional-options "-march=geode" { target ia32 } } */
+
+void
+foo (char *p)
+{
+ __builtin_memset (p, 0, 32);
+}