This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47542] Statement functions and POINTER attribute
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 30 Jan 2011 17:10:14 +0000
- Subject: [Bug fortran/47542] Statement functions and POINTER attribute
- Auto-submitted: auto-generated
- References: <bug-47542-4@http.gcc.gnu.org/bugzilla/>
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