Sunday 15 July 2012

compiler errors - FORTRAN: polymorphism allocation -



compiler errors - FORTRAN: polymorphism allocation -

i trying define subroutine allocate different types of arrays. here simplified version of code:

subroutine allocation1(vec) class(*), allocatable, intent(out) :: vec(:) select type(vec) type is(real(8)) allocate(vec(10)); vec = 0.d0 type is(complex(8)) allocate(vec(10)); vec = (0.d0,0.d0) type is(integer) allocate(vec(10)); vec = 0 endselect endsubroutine allocation1

but got 3 error messages don't understand:

error #8306: associate name defined in associate or select type statements doesn't have allocatable or pointer attribute [vec]

as can see vec allocatable array. don't think error create sense. using ivf xe 14.0.1.139.

if know how prepare it, please give me hand.

thanks

seems compiler bug, works gfortran , solaris studio. recommend contact official intel support.

as ianh points out, possible other compilers in error compile that. anyway, standard conforming or not, procedure still useless, because select type work variable still have allocated, because actual argument procedure must polymorphic. cannot pass real, allocatable there.

compiler-errors polymorphism fortran allocation fortran2003

No comments:

Post a Comment