This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47542] Statement functions and POINTER attribute


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47542

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-30 17:10:02 UTC ---
Richard Maine and Nick seem to agree that it is invalid; Richard wrote:

"It certainly is not intended to be allowed. I'm completely sure of that.
Statement functions were deliberately not extended at the same time as they
were made obsolescent. I'm not seeing the explicit prohibition at the moment,
though I might well just be overlooking it."

Even after looking at the standard, both agree that it is implicitly
disallowed.

 * * *

Draft patch:

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -10231,6 +10231,14 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
       return FAILURE;
     }

+  if (sym->attr.proc == PROC_ST_FUNCTION
+      && (sym->attr.allocatable || sym->attr.pointer))
+    {
+      gfc_error ("Statement function '%s' at %L may not have pointer or "
+                "allocatable attribute", sym->name, &sym->declared_at);
+      return FAILURE;
+    }
+
   /* 5.1.1.5 of the Standard: A function name declared with an asterisk
      char-len-param shall not be array-valued, pointer-valued, recursive
      or pure.  ....snip... A character value of * may only be used in the


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]