[PR 69920] Prevent SRA from leaving a removed SSA_NAME in IL

2016-02-26  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/69920
	* tree-sra.c (sra_modify_assign): Do not remove loads of
	uninitialized aggregates to SSA_NAMEs.

testsuite/
	* gcc.dg/torture/pr69932.c: New test.
	* gcc.dg/torture/pr69936.c: Likewise.

From-SVN: r233753
This commit is contained in:
Martin Jambor 2016-02-26 19:06:42 +01:00 committed by Martin Jambor
parent 1d11f7ce70
commit ad2a27062e
5 changed files with 48 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-02-26 Martin Jambor <mjambor@suse.cz>
PR middle-end/69920
* tree-sra.c (sra_modify_assign): Do not remove loads of
uninitialized aggregates to SSA_NAMEs.
2016-02-26 Richard Henderson <rth@redhat.com>
PR target/69709

View File

@ -1,3 +1,9 @@
2016-02-26 Martin Jambor <mjambor@suse.cz>
PR middle-end/69920
* gcc.dg/torture/pr69932.c: New test.
* gcc.dg/torture/pr69936.c: Likewise.
2016-02-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/69709

View File

@ -0,0 +1,10 @@
/* { dg-do compile } */
int a;
void fn1() {
int b = 4;
short c[4];
c[b] = c[a];
if (c[2]) {}
}

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
int a;
char b;
void fn1(int p1) {}
int fn2() { return 5; }
void fn3() {
if (fn2())
;
else {
char c[5];
c[0] = 5;
lbl_608:
fn1(c[9]);
int d = c[9];
c[2] | a;
d = c[b];
}
goto lbl_608;
}
int main() { return 0; }

View File

@ -3504,7 +3504,8 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
else
{
if (access_has_children_p (racc)
&& !racc->grp_unscalarized_data)
&& !racc->grp_unscalarized_data
&& TREE_CODE (lhs) != SSA_NAME)
{
if (dump_file)
{