This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
- From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 04 May 2015 15:21:31 +0000
- Subject: [Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
- Auto-submitted: auto-generated
- References: <bug-47359-4 at http dot gcc dot gnu dot org/bugzilla/>
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