[Bug fortran/96073] [11.0 regression] regression in gfc_format_decoder

tkoenig at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jul 11 13:11:46 GMT 2020


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

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Two things:  We should not warn about INTENT mismatches when
we artificially generate the prototypes, and we should set a
valid gfc_locus.

Both done with the attached patch.

diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 69f9ca64c97..7768fdc25ca 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -5441,6 +5441,7 @@ check_externals_procedure (gfc_symbol *sym, locus *loc,
   gfc_current_ns = gsym->ns;

   gfc_get_formal_from_actual_arglist (new_sym, actual);
+  new_sym->declared_at = *loc;
   gfc_current_ns = save_ns;

   return 0;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 0cc504f4e04..e51820918b8 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1343,7 +1343,8 @@ gfc_check_dummy_characteristics (gfc_symbol *s1,
gfc_symbol *s2,
     }

   /* Check INTENT.  */
-  if (s1->attr.intent != s2->attr.intent)
+  if (s1->attr.intent != s2->attr.intent && !s1->attr.artificial
+      && !s2->attr.artificial)
     {
       snprintf (errmsg, err_len, "INTENT mismatch in argument '%s'",
                s1->name);


More information about the Gcc-bugs mailing list