re PR middle-end/46734 (ICE in create_tmp_var, at gimplify.c:505)

2010-12-09  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/46734
	* tree-sra.c (splice_param_accesses): Check that there are not
	multiple ADDRESSABLE types.

	* testsuite/g++.dg/tree-ssa/pr46734.C: New test.

From-SVN: r167639
This commit is contained in:
Martin Jambor 2010-12-09 16:11:26 +01:00 committed by Martin Jambor
parent 8b6606f2fa
commit 363e01ccc9
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-12-09 Martin Jambor <mjambor@suse.cz>
PR middle-end/46734
* tree-sra.c (splice_param_accesses): Check that there are not
multiple ADDRESSABLE types.
2010-12-09 Joseph Myers <joseph@codesourcery.com>
* config/arc/arc.h (ASM_SPEC): Remove %{v}.

View File

@ -1,3 +1,8 @@
2010-12-09 Martin Jambor <mjambor@suse.cz>
PR middle-end/46734
* g++.dg/tree-ssa/pr46734.C: New test.
2010-12-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR c++/44641

View File

@ -0,0 +1,34 @@
/* { dg-do compile } */
/* { dg-options "-O -fipa-sra" } */
struct A
{
int *p;
A() {p = (int *) -1;}
~A() {if (p && p != (int *) -1) *p = 0;}
};
struct B
{
A a;
char data[23];
B() : a() {data[0] = 0;}
};
extern A ga;
extern int *gi;
extern void *gz;
extern B *gb;
static int * __attribute__ ((noinline)) foo (B *b, void *z)
{
__builtin_memcpy (gz, z, 28);
ga = b->a;
return b->a.p;
}
int *bar (B *b, void *z)
{
gb = b;
return foo (b, z);
}

View File

@ -3587,7 +3587,10 @@ splice_param_accesses (tree parm, bool *ro_grp)
else if (ac2->size != access->size)
return NULL;
if (access_precludes_ipa_sra_p (ac2))
if (access_precludes_ipa_sra_p (ac2)
|| (ac2->type != access->type
&& (TREE_ADDRESSABLE (ac2->type)
|| TREE_ADDRESSABLE (access->type))))
return NULL;
modification |= ac2->write;