This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 19 Jan 2011 20:44:44 +0000
- Subject: [Bug fortran/47359] Recursive functions of intrinsic names generates invalid assembler
- Auto-submitted: auto-generated
- References: <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.