https://gcc.gnu.org/g:be277865c4d2a820f9f43873b4dde8a6d78c494c
commit r17-555-gbe277865c4d2a820f9f43873b4dde8a6d78c494c Author: Thomas Koenig <[email protected]> Date: Sat May 16 16:37:57 2026 +0200 PR 122245: -fc-prototypes when procedure defined via INTERFACE This simple patch emits correct prototypes when a procedure is defined via an interface by simply checking the presence of an interface and using its formal arglist. gcc/fortran/ChangeLog: PR fortran/122245 * dump-parse-tree.cc (write_formal_arglist): Take the formal arglist from the symbol's interface if it is present. Diff: --- gcc/fortran/dump-parse-tree.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc index 028c946d2d99..1b3c587179c2 100644 --- a/gcc/fortran/dump-parse-tree.cc +++ b/gcc/fortran/dump-parse-tree.cc @@ -4513,7 +4513,12 @@ write_formal_arglist (gfc_symbol *sym, bool bind_c) { gfc_formal_arglist *f; - for (f = sym->formal; f != NULL; f = f->next) + if (sym->ts.interface) + f = sym->ts.interface->formal; + else + f = sym->formal; + + for (; f != NULL; f = f->next) { enum type_return rok; const char *intent_in;
