On 9/23/21 10:10 AM, Tobias Burnus wrote:
On 23.09.21 17:50, Sandra Loosemore wrote:
This patch is for PR101320, another issue related to missing bind(c) diagnostics.  OK to commit?
LGTM - I am only ...
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index f2e8896..b3c65b7 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1557,6 +1557,20 @@ gfc_verify_c_interop_param (gfc_symbol *sym)
                 "CONTIGUOUS attribute as procedure %qs is BIND(C)",
                 sym->name, &sym->declared_at, sym->ns->proc_name->name);
+      /* Per F2018, C1557, pointer/allocatable dummies to a bind(c)
+         procedure that are default-initialized are not permitted.  */
+      if ((sym->attr.pointer || sym->attr.allocatable)
+          && sym->ts.type == BT_DERIVED
+          && gfc_has_default_initializer (sym->ts.u.derived))
+        {
+          gfc_error ("Default-initialized %s dummy argument %qs "
+             "at %L is not permitted in BIND(C) procedure %qs",
+             (sym->attr.pointer ? "pointer" : "allocatable"),

... wondering how to best handle such strings for translators. Namely, whether to duplicate the string and fill-in the %s, rewriting it them to make it clearer for the translator ("dummy argument %qs with %s attribute"), or leaving it as is.

I think the later is acceptable – thus, I assume you will choose that option :-)

Well, "pointer" and "allocatable" are Fortran language keywords, not just regular English words. Should I capitalize them? It didn't seem like other messages in the Fortran front end are consistent about that, but if that's the convention I'll do so here.

-Sandra

Reply via email to