new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int a;
+void fn1() {
+ int b = 4;
+ short c[4];
+ c[b] = c[a];
+ if (c[2]) {}
+
+}
new file mode 100644
@@ -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; }
@@ -3242,6 +3242,7 @@ sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi)
}
else if (racc
&& !racc->grp_unscalarized_data
+ && !racc->grp_unscalarizable_region
&& TREE_CODE (lhs) == SSA_NAME
&& !access_has_replacements_p (racc))
{
@@ -3405,7 +3406,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)
{