[Bug fortran/33847] Interface statement not detected: generate Error: Type/rank mismatch

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Oct 21 10:33:00 GMT 2007



------- Comment #2 from burnus at gcc dot gnu dot org  2007-10-21 10:33 -------
I cannot read. You used:

  interface shape_line_P1
    module procedure shape_line_P1, shape_line_P1_2
  end interface

Thus "shape_line_P1" is both a specific subroutine and a generic subroutine,
however, the standard mandates:

"If the specific name is also a generic name, only the specific procedure is
associated with the dummy argument."

And as the specific subroutine "shape_line_P1" does not match the interface of
sub's dummy argument "sub1", the program is invalid and the error printed by
gfortran and NAG f95 is correct.

To fix the program, change:
    call sub ( shape_line_P1 )    ! wrong specific function
into
    call sub ( shape_line_P1_2 )  ! correct specific function

-----------------

Now to the thing I read:

  interface shape_line_P1
    module procedure shape_line_P1_1, shape_line_P1_2
  end interface !_________________^^

which means that "shape_line_P1" is only a generic function and not a specific
function. However, this is also invalid and properly rejected by gfortran. The
standard writes:

For "a dummy procedure[...], the associated actual argument shall be the
specific name".

Here, gfortran writes:
"Error: GENERIC non-INTRINSIC procedure 'shape_line_p1' is not allowed as an
actual argument"

----------------

Longer excerpt from the Fortran 2003 standard:

"12.4.1.3 Actual arguments associated with dummy procedure entities"
[...]
"If a dummy argument is a dummy procedure without the POINTER attribute, the
associated actual argument shall be the specific name of an external, module,
dummy, or intrinsic procedure, an associated procedure pointer, or a reference
to a function that returns an associated procedure pointer. The only intrinsic
procedures permitted are those listed in 13.6 and not marked with a bullet (*).
If the specific name is also a generic name, only the specific procedure is
associated with the dummy argument."

----------------------------

Closed as invalid on this basis of this analysis.

Nonetheless, thanks for reporting bugs in general - as user feedback is
essential to iron out bugs and sometimes it is not obvious whether something is
a bug or not.


-- 

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=33847



More information about the Gcc-bugs mailing list