[Omp] Fortran assumed-size variables with default(private)

Jakub Jelinek jakub at redhat.com
Mon Oct 24 05:47:19 PDT 2005


Hi!

To my surprise, assumed-size arrays aren't predetermined shared.
Although they are explicitly disallowed for {,first,last}private and
reduction clauses, it is unclear what should happen when they aren't
explicitly listed in the shared directive and default (private)
clause is present.  Intel Fortran compiler will just create a zero-sized
variable and crash at runtime.  IMHO best would be if the standard
made them predetermined shared or stated that with default (private)
they must be explicitly determined.

subroutine bar (a)
  integer :: a (4, *)
  write (*, fmt='(i2 i2 i2 i2 i2)') a(1, 1), a(2, 2), a(3, 3), &
&   a(4, 4), a(1, 6)
end subroutine bar

subroutine foo (a)
  integer :: a (4, *)
  integer omp_get_thread_num
  !$omp parallel num_threads (2) default (private)
    if (omp_get_thread_num () .eq. 1) then
      forall (i = 1:4, j = 1:6) a(i, j) = 6
      call bar (a)
    end if
  !$omp end parallel
  call bar (a)
end subroutine foo

  integer :: a (4, 6)
  a = 8
  call foo (a)
end

	Jakub




More information about the Omp mailing list