gfortran seems to ignore explicit return types of functions. Example follows: -----------------------------bug.for-------------------------------- PROGRAM BUG external real function Mfunc real*4 X,Y X = Xfunc() Y = Mfunc() write(6,*) X,Y stop end real function Xfunc() Xfunc = 17.232 return end real function Mfunc() Mfunc = 17.232 return end -----------------------------bug.for------------------------------ When run, this gives: 17.23200 1.0995535E+09 STOP 0 Compilation was: [...]/gfortran -Wall -o bug bug.for -L[...]/lib64 \ -Wl,-rpath,[...]/lib64 (Long path names replaced with [...]). As usual, thank you very much. The gcc collection is a wonderful tool. -Mike
(In reply to comment #0) > PROGRAM BUG > external real function Mfunc This declares an external symbol called "realfunctionmfunc" (fixed form), which is probably not what you intended. If you replace that line by real Mfunc external Mfunc things work. If you try to compile this in free form (extension .f95), you get a syntax error. I'm resolving this as "invalid". Feel free to re-open it if you believe that I haven't addressed the issue correctly. Thomas
Subject: Re: gfortran ignores explicit return type for fun ctions Thank you very much. My apologies. I don't understand Fortran as well as I should. Sincerely, Mike Albert On Tue, 6 Dec 2005, tkoenig at gcc dot gnu dot org wrote: > > > ------- Comment #1 from tkoenig at gcc dot gnu dot org 2005-12-06 22:14 > ------- > (In reply to comment #0) > > > PROGRAM BUG > > external real function Mfunc > > This declares an external symbol called > "realfunctionmfunc" (fixed form), which is > probably not what you intended. > > If you replace that line by > > real Mfunc > external Mfunc > > things work. If you try to compile this in free form > (extension .f95), you get a syntax error. > > I'm resolving this as "invalid". Feel free to re-open it > if you believe that I haven't addressed the issue correctly. > > Thomas > > > -- > > tkoenig at gcc dot gnu dot org changed: > > What |Removed |Added > ------------------------------------------------------------------------ > ---- > CC| |tkoenig at gcc dot gnu > dot > | |org > Status|UNCONFIRMED |RESOLVED > Resolution| |INVALID > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25174 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. >