This is legal in Fortran, but can cause problems with autogenerated
C prototypes for C23. */
unsigned ext_dummy_arglist_mismatch:1;
+ /* Set if the formal arglist has already been resolved, to avoid
+ trying to generate it again from actual arguments. */
+ unsigned formal_resolved:1;
/* Reference counter, used for memory management.
}
}
}
-
+ if (sym)
+ sym->formal_resolved = 1;
gfc_current_ns = orig_current_ns;
}
&expr->where, &sym->formal_at);
}
}
- else
+ else if (!sym->formal_resolved)
{
gfc_get_formal_from_actual_arglist (sym, expr->value.function.actual);
sym->formal_at = expr->where;
&c->loc, &csym->formal_at);
}
}
- else
+ else if (!csym->formal_resolved)
{
gfc_get_formal_from_actual_arglist (csym, c->ext.actual);
csym->formal_at = c->loc;
--- /dev/null
+! { dg-do compile }
+! { dg-options -Wexternal-argument-mismatch }
+! PR fortran/120163 - this used to cause an error.
+! Original test case by Bálint Aradi
+module mod1
+ implicit none
+
+ abstract interface
+ pure subroutine callback_interface(a)
+ real, intent(in) :: a
+ end subroutine callback_interface
+ end interface
+
+contains
+
+ subroutine caller(callback)
+ procedure(callback_interface) :: callback
+ real :: a
+ call callback(a)
+ end subroutine caller
+
+end module mod1
+
+
+module mod2
+ use mod1
+end module mod2