[Bug fortran/51713] New: Type mismatch for polymorphic dummy arguments depending on "use" path

bugs at stellardeath dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 30 15:07:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51713

             Bug #: 51713
           Summary: Type mismatch for polymorphic dummy arguments
                    depending on "use" path
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bugs@stellardeath.org


Created attachment 26204
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26204
Test case, only compiles when changed according to the comments within

I get a compile-time type-mismatch error for a subroutine usage depending on
how I import the module containing the derived type declaration.

The subroutine is declared to return a class(mytype_t) pointer, it does so by
associating a pointer to a type(mytype_specific_t), an extension of
type(mytype_t).

The definition of type(mytype_specific_t) is in another module, if I now "use"
this module from within the subroutine itself, I get the following error:


$> gfortran -g3 -fcheck=all -pedantic typetest.f90 -o typetest
typetest.f90:42.18:

  call get_mytype(mytype)
                  1
Error: Actual argument to 'mytype' at (1) must have the same declared type


However, If I put the "use" statement in the module enclosing thus subroutine,
it compiles. I think this is an error, as the definition of
type(mytype_specific_t) should not be necessary outside of the subroutine.

As a source file says more than thousand words, see the attached file on which
I get the error.

Regards,
    Lorenz



More information about the Gcc-bugs mailing list