2020-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94270
* interface.c (gfc_get_formal_from_actual_arglist): Always
set artificial attribute for symbols.
* trans-decl.c (generate_local_decl): Do not warn if the
symbol is artifical.
2020-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/94270
* gfortran.dg/warn_unused_dummy_argument_6.f90: New test.
s->ts.is_iso_c = 0;
s->ts.is_c_interop = 0;
s->attr.flavor = FL_VARIABLE;
- s->attr.artificial = 1;
if (a->expr->rank > 0)
{
s->attr.dimension = 1;
s->maybe_array = maybe_dummy_array_arg (a->expr);
}
s->attr.dummy = 1;
+ s->attr.artificial = 1;
s->declared_at = a->expr->where;
s->attr.intent = INTENT_UNKNOWN;
(*f)->sym = s;
/* Unused procedure passed as dummy argument. */
if (sym->attr.flavor == FL_PROCEDURE)
{
- if (!sym->attr.referenced)
+ if (!sym->attr.referenced && !sym->attr.artificial)
{
if (warn_unused_dummy_argument)
gfc_warning (OPT_Wunused_dummy_argument,
--- /dev/null
+! { dg-do compile }
+! { dg-options "-Wall" }
+! PR 94270 - this used to give a bogus warning.
+! Test case by Ignacio Fernández Galván.
+subroutine foo()
+external bar
+call meh(bar)
+call foo_internal()
+contains
+ subroutine foo_internal()
+ call meh(bar)
+ end subroutine foo_internal
+end subroutine foo