diff options
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r-- | gcc/fortran/trans-common.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index d7e3e645965..5c91bf57946 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -547,7 +547,6 @@ get_init_field (segment_info *head, tree union_type, tree *field_init, init = build_constructor (TREE_TYPE (field), v); TREE_CONSTANT (init) = 1; - TREE_INVARIANT (init) = 1; *field_init = init; @@ -657,7 +656,6 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv) gcc_assert (!VEC_empty (constructor_elt, v)); ctor = build_constructor (union_type, v); TREE_CONSTANT (ctor) = 1; - TREE_INVARIANT (ctor) = 1; TREE_STATIC (ctor) = 1; DECL_INITIAL (decl) = ctor; @@ -687,10 +685,14 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv) /* This is a fake variable just for debugging purposes. */ TREE_ASM_WRITTEN (var_decl) = 1; - if (com) + /* To preserve identifier names in COMMON, chain to procedure + scope unless at top level in a module definition. */ + if (com + && s->sym->ns->proc_name + && s->sym->ns->proc_name->attr.flavor == FL_MODULE) var_decl = pushdecl_top_level (var_decl); else - gfc_add_decl_to_function (var_decl); + gfc_add_decl_to_function (var_decl); SET_DECL_VALUE_EXPR (var_decl, fold_build3 (COMPONENT_REF, TREE_TYPE (s->field), |