[Bug fortran/32827] New: IMPORT fails for TYPE when also used in INTERFACE

sysmaint at contek dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 19 23:04:00 GMT 2007


I created a program to invoke POSIX's gettimeofday using BIND(C) and
encountered
a compile-time problem.  In searching the bug database, I discovered 30922,
which exhibited a similar problem (now fixed).  I managed to recreate my
problem in a variant of the test program for 30922, so I am submitting
that program instead in the hope that it is simpler and may be more familiar.

The basic problem arises if I take the 30922 test program, convert it from
a module to a program and then add a declaration for a TYPE'd variable.
I have further simplified the test program, but I have also left the
original 30922 test program in comments.

The test program is:

! Original test program is from bug 30922.
! module test_import
program test_import
  implicit none

  type :: my_type
     integer :: data
  end type my_type

  interface
!     integer function func1(param)
     subroutine func1(param)
       import :: my_type
       type(my_type) :: param
!     end function func1
     end subroutine func1

!      integer function func2(param)
!        import :: my_type
!        type(my_type), value :: param
!      end function func2
  end interface
! end module test_import
  type(my_type) :: x           ! this declaration causes the problem
end program test_import

The error message is:
test_import.f:25.20:

  type(my_type) :: x           ! this declaration causes the problem
                   1
test_import.f:7.17:

  type :: my_type
                2
Error: The type my_type cannot be host associated at (1) because it is blocked
by an incompatible object of the same name at (2)

I believe that it is legal Fortran 2003 to incorporate INTERFACE declarations
immediately within a program, but I could be mistaken.


-- 
           Summary: IMPORT fails for TYPE when also used in INTERFACE
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sysmaint at contek dot com
 GCC build triplet: same - but with bug fix for fortran/32801 included
  GCC host triplet: i386-portbld-freebsd6.2 --  4.3.0 20070713
                    (experimental)
GCC target triplet: same


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



More information about the Gcc-bugs mailing list