Home > Archive > Fortran > December 2006 > Re: Dimension attribute based on host-associated variable - bug in Intel Fortran
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Dimension attribute based on host-associated variable - bug in Intel Fortran
|
|
| David Frank 2006-12-28, 4:03 am |
|
"Rich Townsend" <rhdt@barVOIDtol.udel.edu> wrote in message
news:emv7t5$2rr$1@scrotar.nss.udel.edu...
> Hi all --
>
> A question about what appears to be a bug in the Intel compiler: in a
> module
> subroutine, I have declarations of the form
>
> real, dimension(2*COUNT(spheres%inter)) :: lambda
> real, dimension(COUNT(spheres%inter)) :: rho
> integer, dimension(2*COUNT(spheres%inter)) :: indices
> logical, dimension(COUNT(spheres%inter)) :: active_mask
>
> The array spheres is accessed via host association, and is declared
> thusly:
>
> type sphere_t
> real, dimension(3) :: r = 0. ! Position vector
> real :: l = 0. ! Radius
> real :: rho = 0. ! Density
> real :: lambda_in = 0. ! Ray entrance coordinate
> real :: lambda_ex = 0. ! Ray exit coordinate
> logical :: inter = .FALSE. ! Ray intersection flag
> end type sphere_t
>
> ...
>
> type(sphere_t), dimension(:), allocatable :: spheres
>
> When I try to compile the code using Intel Fortran for Linux (9.1.40), I
> get the
> following error messages:
>
> fortcom: Error: sphimp_dda.f90, line 544: An array-valued argument is
> required
> in this context. [COUNT]
> real, dimension(2*COUNT(spheres%inter)) :: lambda
> ----------------------------^
> fortcom: Error: sphimp_dda.f90, line 545: An array-valued argument is
> required
> in this context. [COUNT]
> real, dimension(COUNT(spheres%inter)) :: rho
> --------------------------^
> fortcom: Error: sphimp_dda.f90, line 546: An array-valued argument is
> required
> in this context. [COUNT]
> integer, dimension(2*COUNT(spheres%inter)) :: indices
> -------------------------------^
> fortcom: Error: sphimp_dda.f90, line 547: An array-valued argument is
> required
> in this context. [COUNT]
> logical, dimension(COUNT(spheres%inter)) :: active_mask
>
> Now, as I understand it, there is nothing wrong with my code;
> spheres%inter is
> an array-valued argument. Can I confirm that this is a bug in the Intel
> compiler?
>
> cheers,
>
> Rich
The compiler says its NOT an array, and of course its RIGHT!
| |
| David Frank 2006-12-28, 8:03 am |
|
"David Frank" <dave_frank@hotmail.com> wrote in message
news:4593856f$0$32092$ec3e2dad@news.usenetmonster.com...
>
>
> The compiler says its NOT an array, and of course its RIGHT!
My statement above being wrong, I investigated various things using CVF
after finding that COUNT intrinsic is unacceptable declaring a subroutine's
auto-size arg.
Below is the closest I could come to syntax that might adapt to your
problem..
module test_1
contains
pure integer function mycount(k)
logical,intent(in) :: k(:)
mycount = count(k) * 2 ! ok to use count intrinsic here
end function
subroutine messy(k,n)
logical :: k(:)
integer :: n
real :: lambda(mycount(k))
n = size(lambda)
end subroutine
end module test_1
program test
use test_1
implicit none
logical :: k(2) = .true.
integer :: size_lambda
call messy( k, size_lambda)
write (*,*) size_lambda ! = 4
end program
|
|
|
|
|