[PR 69355] Correct hole detection when total_scalarization fails

2016-01-27  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/69355
	* tree-sra.c (analyze_access_subtree): Correct hole detection when
	total_scalarization fails.

testsuite/
	* gcc.dg/tree-ssa/pr69355.c: New test.

From-SVN: r232877
This commit is contained in:
Martin Jambor 2016-01-27 15:51:17 +01:00 committed by Martin Jambor
parent 95e3030cfa
commit 1430fb1f56
4 changed files with 56 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-01-27 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/69355
* tree-sra.c (analyze_access_subtree): Correct hole detection when
total_scalarization fails.
2016-01-27 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/driver-rs6000.c (detect_processor_aix): Add

View File

@ -1,3 +1,8 @@
2016-01-27 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/69355
* gcc.dg/tree-ssa/pr69355.c: New test.
2016-01-27 Marek Polacek <polacek@redhat.com>
PR c++/69496

View File

@ -0,0 +1,44 @@
/* { dg-do run } */
/* { dg-options "-O -fno-strict-aliasing" } */
struct S
{
void *a;
long double b;
};
struct Z
{
long long l;
short s;
} __attribute__((packed));
struct S __attribute__((noclone, noinline))
foo (void *v, struct Z *z)
{
struct S t;
t.a = v;
*(struct Z *) &t.b = *z;
return t;
}
struct Z gz;
int
main (int argc, char **argv)
{
struct S s;
if (sizeof (long double) < sizeof (struct Z))
return 0;
gz.l = 0xbeef;
gz.s = 0xab;
s = foo ((void *) 0, &gz);
if ((((struct Z *) &s.b)->l != gz.l)
|| (((struct Z *) &s.b)->s != gz.s))
__builtin_abort ();
return 0;
}

View File

@ -2421,7 +2421,7 @@ analyze_access_subtree (struct access *root, struct access *parent,
if (covered_to < limit)
hole = true;
if (scalar)
if (scalar || !allow_replacements)
root->grp_total_scalarization = 0;
}