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/30876] Array valued recursive function rejected



------- 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


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