[Bug fortran/60777] [F03] RECURSIVE function rejected in specification expression

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 9 14:56:00 GMT 2016


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

--- Comment #6 from janus at gcc dot gnu.org ---
I think the patch in comment 1 actually does not work as expected (due to a
spurious semicolon).

However, this variant seems to work well and regtests cleanly:


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 241997)
+++ gcc/fortran/expr.c  (working copy)
@@ -2794,12 +2794,12 @@
       return false;
     }

-  if (f->attr.recursive)
-    {
-      gfc_error ("Specification function %qs at %L cannot be RECURSIVE",
-                f->name, &e->where);
+  /* F08:7.1.11.6. */
+  if (f->attr.recursive
+      && !gfc_notify_std (GFC_STD_F2003,
+                         "Specification function '%s' "
+                         "at %L cannot be RECURSIVE",  f->name, &e->where))
       return false;
-    }

 function_allowed:
   return restricted_args (e->value.function.actual);


I will commit this soon.


More information about the Gcc-bugs mailing list