]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove stalled TREE_READONLY flag on automatic variable
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 25 May 2021 16:30:29 +0000 (18:30 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 25 May 2021 16:31:43 +0000 (18:31 +0200)
gcc/
* gimplify.c (gimplify_decl_expr): Clear TREE_READONLY on the DECL
when really creating an initialization statement for it.

gcc/gimplify.c

index b62ea0efc1cb589c0d254f32deefcd197ca8eb5a..ed825a93aa1b3c74dcd2ce69fd6ee9afc1c27abf 100644 (file)
@@ -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