[Bug fortran/30902] gfortran produces wrong result with code using generic interface block
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Feb 21 07:33:00 GMT 2007
------- Comment #2 from burnus at gcc dot gnu dot org 2007-02-21 07:33 -------
(In reply to comment #0)
> The attached test code using a generic interface block produces wrong output
> when compiled with gfortran, and works fine with pgf90.
I think both compilers are right; or to be more precise: The program is
wrong/undefined.
If one removes the INTERFACE blocks and puts the subroutines into below a
CONTAINS in the main program, gfortran gives the following error:
call adsorb(tsl, gamm, adwat, wsc, dime = ns, mode = 1)
1
Error: Type/rank mismatch in argument 'te' at (1)
The actual argument "tsl" is REAL, DIMENSION(10);
the dummy argument "te" is REAL, INTENT(IN) :: gam, te
Analogously for gam(m) and adwat/adsor.
Thus: The compiler expects in the main program that it has to pass an array,
but the routine only accepts a single real.
What happens in your program is now highly platform and compiler dependent:
pgf90 seems to set all values to "0.5104298" (but I wouldn't rely on this
happening all the times), gfortran has seemingly "0.5104298" in adwat(10) only.
(The rest is uninitialized.) And ifort/g95 have for the whole array adwat(:)
uninitialized values.
By the way, NAG f95 detects the interface/procedure mismatch also for the
original program as the interface and the subroutines are in the same file.
This same-file error detection is also planed for gfortran.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30902
More information about the Gcc-bugs
mailing list