https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108336
--- Comment #4 from anlauf at gcc dot gnu.org ---
There is one flaw with the testcase: when OMP_NUM_THREADS > n1,
array elements threadval(n1+1:OMP_NUM_THREADS) are filled with
undefined values.
When I replace the line
if(omp_get_thread_num() /= 0) call random_number(x1)
by the following loop:
do i = 1, nt
if (i > 1 .and. omp_get_thread_num() == i-1) call random_number(x1)
!$omp barrier
end do
and furthermore do
print*, minval(threadval(1:n1)), maxval(threadval(1:n1))
I get repeatable results.
Am I missing something?