This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30876] Array valued recursive function rejected
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Mar 2007 00:22:42 -0000
- Subject: [Bug fortran/30876] Array valued recursive function rejected
- References: <bug-30876-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2007-03-22 00:22 -------
(In reply to comment #3)
> "12.5.2.1 Function subprogram"
> "If RESULT is not specified, the result variable is <function- name> and all
> occurrences of the function name in execution-part statements are references to
> the result variable."
Then, the following should be invalid and rejected, shouldn't it?
recursive function f(i)
integer :: f, i
f = 0
if (i > 0) f = f(i-1) + 1
end function
If every occurence of f is a reference to the variable result, it's strictly
equivalent to the following, clearly invalid code:
recursive function f(i) result(g)
integer :: g, i
g = 0
if (i > 0) g = g(i-1) + 1
end function
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30876