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




"David Frank" <dave_frank@xxxxxxxxxxx> wrote in message
news:4593856f$0$32092$ec3e2dad@xxxxxxxxxxxxxxxxxxxxxxxxx


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


.



Relevant Pages

  • Re: LEN() of unallocated array
    ... > observation that CVF has erroneously allocated the array at illegal ... > end subroutine my_sub ... > end program test ...
    (comp.lang.fortran)
  • Re: Fortran Newbie - Where to start?
    ... even CVF 6.6C experiences unhappiness when it ... implicit none ... end subroutine Y ... end program test ...
    (comp.lang.fortran)
  • Re: LEN() of unallocated array
    ... > Now, AFAIK, the above subroutine is legal Fortran; ... > end program test ... CVF compiles above ok, but has a runtime access error on execution. ... allocate ) ...
    (comp.lang.fortran)
  • Re: Conditional Variable Type Declarations
    ... subroutine ReadData(ioUnit, keywordDimens, int_vector, string_vector) ... end program test ... this is provided by placing Readdata in a module in the above example. ...
    (comp.lang.fortran)
  • Re: How calling a cpp-dll?
    ... which is based on cpp. ... subroutine stdvar_string ... end interface ... end program test ...
    (comp.lang.fortran)