This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler
- From: "roger.ferrer at bsc dot es" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Jan 2011 11:24:22 +0000
- Subject: [Bug fortran/47359] New: Recursive functions of intrinsic names generates invalid assembler
- Auto-submitted: auto-generated
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 :)