public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
Date: Wed, 19 Jan 2011 20:53:00 -0000	[thread overview]
Message-ID: <bug-47359-4-LyB5qEMUib@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47359-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47359

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-01-19 20:44:27 UTC ---
> I know this is sort of a contrived case but seems that gfortran is getting
> confused in this case leading to syntactically invalid assembler.

I don't see the invalid assembler on x86_64-apple-darwin10 and
powerpc-apple-darwin9 for trunk (4.6), 4.50, and 4.4.4. However gfortran is
indeed confused by the code as shown by the following modification:

RECURSIVE FUNCTION MAX(A, B, i) RESULT(K)
  real i
  i = i + 1
  IF (B >= 0) THEN
         K = MAX(A+1, B-1, i)
  ELSE
     K = A
  END IF
END
RECURSIVE FUNCTION myMAX(A, B, i) RESULT(K)
  real i
  i = i + 1
  IF (B >= 0) THEN
         K = myMAX(A+1, B-1, i)
  ELSE
     K = A
  END IF
END
external max
a = 0
b = 0
i = max(3.2,0.2, a)
j = mymax(3.2,0.2, b)
print *, i, j, a, b
a = 0
b = 0
i = max(3.2,2.2, a)
j = mymax(3.2,2.2, b)
print *, i, j, a, b
end
[macbook] f90/bug% gfc pr47359_db_3.f90
[macbook] f90/bug% a.out
           4           4   1.0000000       2.0000000    
           4           6   1.0000000       4.0000000    

where I had to declare 'i' REAL in order to avoid a compilation error and
clearly the external MAX is called, but only once apparently because the call
to MAX in MAX is a call to the intrinsic. g95 gives

 4 4 2. 2.
 6 6 4. 4.


  reply	other threads:[~2011-01-19 20:44 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 ` dominiq at lps dot ens.fr [this message]
2011-05-23 10:39 ` [Bug fortran/47359] " dominiq at lps dot ens.fr
2015-05-04 15:21 ` fxcoudert at gcc dot gnu.org
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-LyB5qEMUib@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).