https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47359
Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2011-05-23 09:58:19 |2015-5-4
CC| |fxcoudert at gcc dot gnu.org
--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Still fails. Somewhat reduced/reworked testcase:
program test
external max
print *, max(42, 1)
end
recursive function max(a, b) result(k)
integer a, b, k
if (b > 0) then
k = max(a, b-1)
else
k = 0
end if
end function
where you can see that generated code for function "max" does not call itself,
as it should. The output of that program is "42", while it should be "0".
Providing an explicit interface for "max" is also not working:
program test
interface
recursive function max(a, b) result(k)
integer a, b, k
end function
end interface
print *, max(42, 1)
end
recursive function max(a, b) result(k)
integer a, b, k
if (b > 0) then
k = max(a, b-1)
else
k = 0
end if
end function