tags:

views:

261

answers:

0

I'm creating a simple 'vector' type with overloaded basic operations like adding, assignment and so on. I'm hiding the implementation into a module. As a bare minimum I have to provide a facility to assign a 'usual' array to a 'vector'. When compiled with Intel Fortran compiler, I am receiving a warning that an array temporary is created. Googling tells me that this warning is usually associated with mixing fortran 77 arrays (contiguous in memory) and fortran 90 arrays (not necessarily contiguous).

What I'm confused about is that in the code below I don't seem to be ever using fortran 77 style arrays. It seems that I'm missing something kindergarten-ish, but I can't figure what is the issue. Can anybody clarify it?

Here's the offending code:

UPDATE: answered here. Turns out to be a bug/feature of an intel compiler.

module blah
implicit none

integer,parameter :: d=3           ! dimension


public  assignment(=), momentum,d,dump



private

! basic type itself
type momentum

private

integer, dimension(d) :: elem

end type momentum

interface assignment(=)         

module procedure arr        ! assign arr to vector

end interface

contains

! assign array to vector --- the offending procedure
subroutine arr(ve,ar)

implicit none

type(momentum), intent(out) :: ve

integer, intent(in)  :: ar(d)

ve%elem=ar

end subroutine arr

end module blah

!+++++++++++++++++++++++++++++++++++
program trrry
use blah
implicit none
type(momentum) :: ve
integer :: a(d)

a=1;
ve=a;            ! this call generates the warning

end program trrry