> LGTM.
Thanks, but a bit too bold because gimplify_and_add can promote the non-static
DECL to static memory and reinstate DECL_INITIAL, so first hunk adjusted.
* gimplify.c (gimplify_decl_expr): Clear TREE_READONLY on the DECL
when really creating an initialization statement for it.
--
Eric Botcazou
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b62ea0efc1c..ed825a93aa1 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1828,6 +1828,9 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
init = build2 (INIT_EXPR, void_type_node, decl, init);
gimplify_and_add (init, seq_p);
ggc_free (init);
+ /* Clear TREE_READONLY if we really have an initialization. */
+ if (!DECL_INITIAL (decl))
+ TREE_READONLY (decl) = 0;
}
else
/* We must still examine initializers for static variables