--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O1" } */
+
+struct a {
+ int b : 4;
+} d;
+static int c, e;
+static const struct a f;
+static void g(const struct a h) {
+ for (; c < 1; c++)
+ d = h;
+ e = h.b;
+ c = h.b;
+}
+int main() {
+ g(f);
+ return 0;
+}
|| stmt_ends_bb_p (stmt))
{
/* No need to copy into a constant-pool, it comes pre-initialized. */
- if (access_has_children_p (racc) && !constant_decl_p (racc->base))
+ if (access_has_children_p (racc) && !TREE_READONLY (racc->base))
generate_subtree_copies (racc->first_child, rhs, racc->offset, 0, 0,
gsi, false, false, loc);
if (access_has_children_p (lacc))
}
/* Restore the aggregate RHS from its components so the
prevailing aggregate copy does the right thing. */
- if (access_has_children_p (racc))
+ if (access_has_children_p (racc) && !TREE_READONLY (racc->base))
generate_subtree_copies (racc->first_child, rhs, racc->offset, 0, 0,
gsi, false, false, loc);
/* Re-load the components of the aggregate copy destination.