gcc:
PR tree-optimization/70013
* tree-sra.c (analyze_access_subtree): Also set grp_unscalarized_data
for constant-pool entries.
gcc/testsuite:
* gcc.dg/tree-ssa/sra-20.c: New.
From-SVN: r234138
+2016-03-11 Alan Lawrence <alan.lawrence@arm.com>
+
+ PR tree-optimization/70013
+ * tree-sra.c (analyze_access_subtree): Also set grp_unscalarized_data
+ for constant-pool entries.
+
2016-03-11 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/70174
+2016-03-11 Alan Lawrence <alan.lawrence@arm.com>
+
+ * gcc.dg/tree-ssa/sra-20.c: New.
+
2016-03-11 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/70174
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O1 -Wall" } */
+/* PR/70013, SRA of constant-pool loads removes initialization of part of d. */
+#pragma pack (1)
+struct S0 {
+ unsigned f0 : 17;
+};
+
+int c;
+
+int
+main (int argc, char **argv)
+{
+ struct S0 d[] = { { 1 }, { 2 } };
+ struct S0 e = d[1];
+
+ c = d[0].f0;
+ __builtin_printf ("%x\n", e.f0);
+ return 0;
+}
if (!hole || root->grp_total_scalarization)
root->grp_covered = 1;
- else if (root->grp_write || TREE_CODE (root->base) == PARM_DECL)
+ else if (root->grp_write || TREE_CODE (root->base) == PARM_DECL
+ || constant_decl_p (root->base))
root->grp_unscalarized_data = 1; /* not covered and written to */
return sth_created;
}