re PR tree-optimization/71707 (ICE in get_stridx_plus_constant)
PR tree-optimization/71707 * tree-ssa-strlen.c (get_stridx_plus_constant): Handle already present strinfo even for ADDR_EXPR ptr. * gcc.dg/strlenopt-29.c: New test. From-SVN: r237889
This commit is contained in:
parent
6245ad72d2
commit
55a0f21aba
|
@ -1,3 +1,9 @@
|
|||
2016-06-30 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/71707
|
||||
* tree-ssa-strlen.c (get_stridx_plus_constant): Handle already present
|
||||
strinfo even for ADDR_EXPR ptr.
|
||||
|
||||
2016-06-30 Kelvin Nilsen <kelvin@gcc.gnu.org>
|
||||
|
||||
* config/rs6000/altivec.md (darn_32): Change the condition to
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2016-06-30 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/71707
|
||||
* gcc.dg/strlenopt-29.c: New test.
|
||||
|
||||
PR fortran/71704
|
||||
* gfortran.dg/gomp/pr71704.f90: New test.
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* PR tree-optimization/71707 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2 -fdump-tree-strlen" } */
|
||||
|
||||
#include "strlenopt.h"
|
||||
|
||||
char a[32];
|
||||
size_t b;
|
||||
|
||||
__attribute__((noinline, noclone)) char *
|
||||
foo (void)
|
||||
{
|
||||
char *p = memcpy (a, "a", 2) + 1;
|
||||
memcpy (&a[1], "b", 2);
|
||||
b = strlen (a) + strlen (&a[1]) + strlen (p);
|
||||
return p;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (foo () != &a[1] || b != 4)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */
|
|
@ -677,8 +677,14 @@ get_stridx_plus_constant (strinfo *basesi, HOST_WIDE_INT off, tree ptr)
|
|||
{
|
||||
if (r == 0)
|
||||
{
|
||||
gcc_assert (TREE_CODE (ptr) == SSA_NAME);
|
||||
ssa_ver_to_stridx[SSA_NAME_VERSION (ptr)] = si->idx;
|
||||
if (TREE_CODE (ptr) == SSA_NAME)
|
||||
ssa_ver_to_stridx[SSA_NAME_VERSION (ptr)] = si->idx;
|
||||
else
|
||||
{
|
||||
int *pidx = addr_stridxptr (TREE_OPERAND (ptr, 0));
|
||||
if (pidx != NULL && *pidx == 0)
|
||||
*pidx = si->idx;
|
||||
}
|
||||
return si->idx;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue