[Bug fortran/34260] Give warning if procedure with implicit interface is called with different arguments

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Nov 28 13:54:00 GMT 2007

------- Comment #3 from burnus at gcc dot gnu dot org  2007-11-28 13:54 -------
If no explicit interface is known, the following produces is almost all cases
invalid code:
      CALL SUB(A,I)
      CALL SUB(A)

Other compilers detect this such as NAG f95:
   Error: line 5: Different number of arguments from the first call of SUB
or g95:
   Warning (154): Inconsistent number of arguments in reference to 'sub' at (1)
and (2)

> OK, thanks. I realize the difficulty here when routines are complied
> separately
Currently, gfortran does not do in-file consistency checks. Though this is
planned. It won't help for if they are compiled separately.

> but perhaps  a warning might be possible at the linking stage...
No, the linking is done by the linker and not the compiler and it has not such
knowledge. It only sees whether a symbol ("sub_") can be resolved or not.


burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
           Severity|blocker                     |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-28 13:54:16
               date|                            |
            Summary|present returns wrong value |Give warning if procedure
                   |of optional variables       |with implicit interface is
                   |                            |called with different
                   |                            |arguments


More information about the Gcc-bugs mailing list