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]

Re: host association question..


the decl of the local variables there doesn't make much sense, but just 
fyi, those were params to the routine originally, which is why they're 
there.  that just got cut out.  i came across this when testing the 'only' 
clause usage of the iso_c_binding intrinsic module; i was seeing variables 
being allowed for defining parameters even though they weren't listed in 
the 'only' clause.  but, the error exists w/o using the C interop 
stuff, so i felt safe in saying it wasn't my code causing the problem.

Chris

On Thu, 16 Feb 2006, Erik Edelmann wrote:

> On Wed, Feb 15, 2006 at 03:20:09PM -0700, Christopher D. Rickett wrote:
> > 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?
> 
> Yes, I think you are right.  We apperantly have a case of
> "accepts invalid" here.  In fact, isn't it an error to have
> declarations of procedure variables in an interface block,
> regardles of their type?  Unless I'm missing something, it
> doesn't make much sense to have those declarations there.
> 
> 
>         Erik
> 


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