https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96013

--- Comment #6 from kargl at gcc dot gnu.org ---
With this patch the code compiles:

Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c        (revision 280157)
+++ gcc/fortran/module.c        (working copy)
@@ -5737,8 +5737,13 @@ write_symbol (int n, gfc_symbol *sym)
 {
   const char *label;

-  if (sym->attr.flavor == FL_UNKNOWN || sym->attr.flavor == FL_LABEL)
-    gfc_internal_error ("write_symbol(): bad module symbol %qs", sym->name);
+  if ((sym->attr.flavor == FL_UNKNOWN || sym->attr.flavor == FL_LABEL)
+      && !(sym->ts.type != BT_UNKNOWN && sym->attr.result))
+    {
+      gfc_error ("Invalid symbol %qs at %L", sym->name,
+                &sym->declared_at);
+      return;
+    }

   mio_integer (&n);


As far as setting 't', one can get a warning with -Wall.
gfcx -Wall -c a.f90
a.f90:5:25:

    5 |    function f() result(t)
      |                         1
Warning: Return value 't' of function 'f' declared at (1) not set
[-Wreturn-typ]

Not sure why this isn't an error (perhaps, false-positives?).

Reply via email to