summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 77ba3f8498c..4c3f52bd7b7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4438,7 +4438,8 @@ free_lang_data_in_decl (tree decl)
&& !TREE_STATIC (expr) && !DECL_EXTERNAL (expr))
SET_DECL_DEBUG_EXPR (decl, NULL_TREE);
- if (DECL_EXTERNAL (decl))
+ if (DECL_EXTERNAL (decl)
+ && (!TREE_STATIC (decl) || !TREE_READONLY (decl)))
DECL_INITIAL (decl) = NULL_TREE;
}
else if (TREE_CODE (decl) == TYPE_DECL)