This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

host association question..


given the following code:

module myMod
  integer, parameter :: mine = 4

  type :: MYFTYPE_1
     integer :: i, j
     real :: s
  end type MYFTYPE_1

  interface
     subroutine blah()
       implicit none
       type(myftype_1) :: myStruct
       type(myftype_1) :: myStruct2
       integer(mine) :: myInt
     end subroutine blah
  end interface
end module myMod

gfortran will produce the following error:

In file myMod.f90:14

       integer(mine) :: myInt
                  1
Error: Symbol 'mine' at (1) has no IMPLICIT type


ifort will give the following errors for the same code:

fortcom: Error: myMod.f90, line 12: This derived type name has not been 
declared.   [MYFTYPE_1]
       type(myftype_1) :: myStruct
------------^
fortcom: Error: myMod.f90, line 13: This derived type name has not been 
declared.   [MYFTYPE_1]
       type(myftype_1) :: myStruct2
------------^
fortcom: Error: myMod.f90, line 14: A kind type parameter must be a 
compile-time constant.   [MINE]
       integer(mine) :: myInt
---------------^

if you remove the one reference to 'mine' w/in the blah(), gfortran will 
compile the code.  however, i think that this is an error, if i understand 
host association.  it appears that ifort gives the 3 errors because 
neither 'myftype_1' nor 'mine' can be host associated for the subroutine 
blah() to use them.  in order to be host associated, the module 'myMod' 
must contain the subroutine.  is this correct?

these tests were done with ifort 9.0 and gfortran 4.2.0 20060130 
(experimental).  it was also done with gfortran 4.1.0 20051026 
(experimental).  both versions of gfortran behaved the same way.

Thanks.
Chris




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]