This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30902] gfortran produces wrong result with code using generic interface block
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Feb 2007 07:33:38 -0000
- Subject: [Bug fortran/30902] gfortran produces wrong result with code using generic interface block
- References: <bug-30902-8911@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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