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

Reply via email to