This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, FORTRAN] Fix PR 35892 regression


George Helffrich wrote:
This patch fixes the gfortran regression reported in PR 35892.

If the common decl has no associated procedure due to it being top-level in a module, it is chained to the global scope.

No testsuite regressions associated with patch.

Relevant part of the patch here; full one attached.

Index: gcc/fortran/trans-common.c
===================================================================
--- gcc/fortran/trans-common.c  (revision 134642)
+++ gcc/fortran/trans-common.c  (working copy)
@@ -685,10 +685,14 @@
       /* 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),


OK to commit?



--
George Helffrich

OK, thanks George,


Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]