diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2668f2e7c69..d9cfd0e08f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-02-26 Martin Jambor + + 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 PR target/69709 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a70a06970bc..5a928892cb7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-02-26 Martin Jambor + + PR middle-end/69920 + * gcc.dg/torture/pr69932.c: New test. + * gcc.dg/torture/pr69936.c: Likewise. + 2016-02-26 Andreas Krebbel PR target/69709 diff --git a/gcc/testsuite/gcc.dg/torture/pr69932.c b/gcc/testsuite/gcc.dg/torture/pr69932.c new file mode 100644 index 00000000000..4b82130157b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69932.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +int a; +void fn1() { + int b = 4; + short c[4]; + c[b] = c[a]; + if (c[2]) {} + +} diff --git a/gcc/testsuite/gcc.dg/torture/pr69936.c b/gcc/testsuite/gcc.dg/torture/pr69936.c new file mode 100644 index 00000000000..3023bbbb1c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr69936.c @@ -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; } diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 663ded2e121..366f4134e73 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -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) {