[PATCH, FORTRAN] Fix PR 35892 regression

Jerry DeLisle jvdelisle@verizon.net
Fri Apr 25 14:11:00 GMT 2008


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



More information about the Fortran mailing list