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: "burnus 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 07:41:17 -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 #6 from burnus at gcc dot gnu dot org 2007-03-22 07:41 -------
(In reply to comment #5)
> 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
NAG f95:
line 4: Recursive invocation of F which has no RESULT clause
(gfortran and ifort allow this)
> recursive function f(i) result(g)
> integer :: g, i
> g = 0
> if (i > 0) g = g(i-1) + 1
> end function
NAG f95: Inconsistent usage of G
ifort: This name has not been declared as an array or a function
gfortran: Cannot assign to a named constant
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30876