]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR 122245: -fc-prototypes when procedure defined via INTERFACE
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 16 May 2026 14:37:57 +0000 (16:37 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 16 May 2026 14:37:57 +0000 (16:37 +0200)
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.

gcc/fortran/dump-parse-tree.cc

index 028c946d2d99e197977190068b25098ac7d09237..1b3c587179c2c93871f4f8f9fd66afc7193998f4 100644 (file)
@@ -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;