https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54880

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> One way to get rid of the error is to simply remove the assert that causes it
> (which was already constrained by Paul for PR43450). However, I'm not sure if
> that's justified.

The asserts were introduced at revision r139773 to solve a problem with COMMON
and DW_TAG_common_block (PRs 23057 and 29635). I fail to understand their
logic: why

       TYPE_CONTEXT (decl) = sym->ns->proc_name->backend_decl;

if

TYPE_CONTEXT (decl) == sym->ns->proc_name->backend_decl?

Updated patch

--- ../_clean/gcc/fortran/trans-decl.c  2019-02-02 01:32:53.000000000 +0100
+++ gcc/fortran/trans-decl.c    2019-02-02 09:32:15.000000000 +0100
@@ -4975,14 +4975,6 @@ gfc_create_module_variable (gfc_symbol *
       decl = sym->backend_decl;
       gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE);

-      if (!sym->attr.use_assoc && !sym->attr.used_in_submodule)
-       {
-         gcc_assert (TYPE_CONTEXT (decl) == NULL_TREE
-                     || TYPE_CONTEXT (decl) ==
sym->ns->proc_name->backend_decl);
-         gcc_assert (DECL_CONTEXT (TYPE_STUB_DECL (decl)) == NULL_TREE
-                     || DECL_CONTEXT (TYPE_STUB_DECL (decl))
-                          == sym->ns->proc_name->backend_decl);
-       }
       TYPE_CONTEXT (decl) = sym->ns->proc_name->backend_decl;
       DECL_CONTEXT (TYPE_STUB_DECL (decl)) = sym->ns->proc_name->backend_decl;
       gfc_module_add_decl (cur_module, TYPE_STUB_DECL (decl));

> At least it does not introduce any regressions in the testsuite.

Removing an assert cannot introduce any regression.

Reply via email to