public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler
@ 2011-01-19 12:24 roger.ferrer at bsc dot es
  2011-01-19 20:53 ` [Bug fortran/47359] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: roger.ferrer at bsc dot es @ 2011-01-19 12:24 UTC (permalink / raw)
  To: gcc-bugs

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 :)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-16 20:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 12:24 [Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler 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
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

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).