[patch, fortran] PR 122245: Fix -fc-prototypes when procedure is defined via INTERFACE
Thomas Koenig <[email protected]>
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
Hello world, what it says in the ChangeLog. No test case, see PR 120220. Thanks to Harald for spotting this. Regression-tested. OK for trunk? Best regards Thomas PR 122245: Fix -fc-prototypes when procedure is 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.
p1.diff
(text/x-patch, 538 B)
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 028c946d2d9..1b3c587179c 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;