Commit 97246d78 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/50613 (ICE: tree check: expected ssa_name, have…

re PR tree-optimization/50613 (ICE: tree check: expected ssa_name, have addr_expr in find_equal_ptrs, at tree-ssa-strlen.c:712 with -foptimize-strlen -fno-tree-ccp)

	PR tree-optimization/50613
	* tree-ssa-strlen.c (find_equal_ptrs): If CASE_CONVERT
	operand is ADDR_EXPR, fallthru into ADDR_EXPR handling,
	and if it is neither that not SSA_NAME, give up.

	* gcc.dg/pr50613.c: New test.

From-SVN: r179567
parent 9974107a
2011-10-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/50613
* tree-ssa-strlen.c (find_equal_ptrs): If CASE_CONVERT
operand is ADDR_EXPR, fallthru into ADDR_EXPR handling,
and if it is neither that not SSA_NAME, give up.
2011-10-05 Richard Henderson <rth@redhat.com>
* tree-vect-generic.c (vector_element): Never fail. Use
2011-10-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/50613
* gcc.dg/pr50613.c: New test.
2011-10-05 Richard Henderson <rth@redhat.com>
* gcc.c-torture/execute/vect-shuffle-1.c: Rewrite.
......
/* PR tree-optimization/50613 */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-ccp" } */
#include "strlenopt.h"
char buf[26];
static inline void
bar (char *__restrict dest, const char *__restrict src)
{
strcpy (dest, src);
}
void
foo (char *p)
{
if (strlen (p) < 50)
bar (buf, p);
}
......@@ -692,6 +692,14 @@ find_equal_ptrs (tree ptr, int idx)
{
case SSA_NAME:
break;
CASE_CONVERT:
if (!POINTER_TYPE_P (TREE_TYPE (ptr)))
return;
if (TREE_CODE (ptr) == SSA_NAME)
break;
if (TREE_CODE (ptr) != ADDR_EXPR)
return;
/* FALLTHRU */
case ADDR_EXPR:
{
int *pidx = addr_stridxptr (TREE_OPERAND (ptr, 0));
......@@ -699,10 +707,6 @@ find_equal_ptrs (tree ptr, int idx)
*pidx = idx;
return;
}
CASE_CONVERT:
if (POINTER_TYPE_P (TREE_TYPE (ptr)))
break;
return;
default:
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment