Re: Dimension attribute based on host-associated variable - bug in Intel Fortran




Rich Townsend schreef:

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?

I tried the following program with Intel Fortran 8.1 on Linux:

program sphereprogram
type sphere
logical :: has
end type sphere

type(sphere), dimension(3) :: spheres

spheres(1)%has = .false.
spheres(2)%has = .true.
spheres(3)%has = .false.
write(*,*) count(spheres%has)
end program

It seems perfectly happy, so I do think your version 9.1.40 is
misinterpreting
the code.

Regards,

Arjen

.