2008-01-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / openmp_stack.f90
blob97dd9156cf27d9c1ee73af428bea57f1244c3991
1 ! { dg-do run}
2 ! { dg-options "-fopenmp" }
3 program openmp_stack
4 implicit none
5 integer id
6 integer ilocs(2)
7 integer omp_get_thread_num, foo
8 call omp_set_num_threads (2)
9 !$omp parallel private (id)
10 id = omp_get_thread_num() + 1
11 ilocs(id) = foo()
12 !$omp end parallel
13 ! Check that the two threads are not sharing a location for
14 ! the array x in foo()
15 if (ilocs(1) .eq. ilocs(2)) call abort
16 end program openmp_stack
18 integer function foo ()
19 implicit none
20 real x(100,100)
21 foo = loc(x)
22 end function foo