public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
Date: Mon, 04 May 2015 15:21:00 -0000	[thread overview]
Message-ID: <bug-47359-4-3Fo7UfclpF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47359-4@http.gcc.gnu.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


  parent reply	other threads:[~2015-05-04 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 12:24 [Bug fortran/47359] New: " roger.ferrer at bsc dot es
2011-01-19 20:53 ` [Bug fortran/47359] " dominiq at lps dot ens.fr
2011-05-23 10:39 ` dominiq at lps dot ens.fr
2015-05-04 15:21 ` fxcoudert at gcc dot gnu.org [this message]
2015-06-06 16:13 ` tkoenig at gcc dot gnu.org
2015-06-06 16:16 ` tkoenig at gcc dot gnu.org
2015-06-06 18:23 ` tkoenig at gcc dot gnu.org
2022-05-16 20:38 ` anlauf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47359-4-3Fo7UfclpF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).