public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roger.ferrer at bsc dot es" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler
Date: Wed, 19 Jan 2011 12:24:00 -0000	[thread overview]
Message-ID: <bug-47359-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: Recursive functions of intrinsic names generates
                    invalid assembler
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roger.ferrer@bsc.es


I know this is sort of a contrived case but seems that gfortran is getting
confused in this case leading to syntactically invalid assembler.

RECURSIVE FUNCTION MAX(A, B) RESULT(K)
  IF (B >= 0) THEN
         K = MAX(A+1, B-1)
  ELSE
     K = A
  END IF
END

$ gfortran -c test.f90 -save-temps
test.s:11: Error: junk at end of line, first unrecognized character is `('
test.s:12: Error: unrecognized symbol type ""
test.s:12: Error: junk at end of line, first unrecognized character is `('
test.s:13: Error: Unrecognized opcode: `__(intrinsic)__max:'
test.s:73: Error: expected comma after name `__' in .size directive
$ cat -n test.s 
  ...
    11        .globl __(intrinsic)__max
    12        .type    __(intrinsic)__max, @function
    13    __(intrinsic)__max:
  ...
    73        .size    __(intrinsic)__max,.-__(intrinsic)__max


My guess is that gfortran is picking the intrinsic 'max' function symbol
instead of the one being currently defined (which is recursive and thus is
eligible to be called in its same body, isn't it?)

I don't know how much conformant this is to Fortran standard but Intel Fortran
and IBM XL Fortran did not complain and successfully generated an object file. 

If this is not valid Fortran, an error message is better than a cryptic
assembler syntax error :)


             reply	other threads:[~2011-01-19 11:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 12:24 roger.ferrer at bsc dot es [this message]
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
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@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).