[Omp] Sharing attributes of parent function's variables

Jakub Jelinek jakub at redhat.com
Tue Sep 19 02:14:51 PDT 2006


Hi!

What are the sharing attributes of parent function's variables?
Shall the nested function always see the original (non-remapped)
variables of parent function, or shall it see the remapped (e.g.
privatized) variables, or is it undefined?
I tried Intel ifort 9.1.037 and it prints clearly uninitialized
memory.

! { dg-do run }
! { dg-options "-O2 -fopenmp" }

program nestomp
  use omp_lib
  integer :: j
  j = 8
  !$omp parallel firstprivate (j) num_threads(3)
    j = 12 + omp_get_thread_num ()
    call bar
  !$omp end parallel
contains
  subroutine bar
    use omp_lib
    print *, j, omp_get_thread_num ()
  end subroutine
end

	Jakub


More information about the Omp mailing list