[Bug fortran/50525] gfortran should not allow early reference to entry dummy argument (r178939)

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 27 12:44:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50525

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-27 12:12:03 UTC ---
I meant something like the following. Though, the wording could be improved.

--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4296,6 +4296,14 @@ gfc_match_formal_arglist (gfc_symbol *progname, int
st_flag, int null_flag)

          if (gfc_get_symbol (name, NULL, &sym))
            goto cleanup;
+
+         if (sym->attr.referenced && !sym->attr.dummy)
+           {
+             gfc_error ("Argument '%s' at %C has been already used at %L",
+                        sym->name, &sym->declared_at);
+             m = MATCH_ERROR;
+             goto cleanup;
+           }
        }

       p = gfc_get_formal_arglist ();



More information about the Gcc-bugs mailing list