The following code, built with 126.96.36.199 in debug mode with "/standard-semantics" fails execution with "Critical error detected c0000374":
program mfort implicit none real, allocatable :: x(:) integer :: i,j x=[1,2,3] !$omp parallel do private(x) do i=1,10 x=[(j,j=1,12)] print *,sum(x) enddo end program
Thank you for your suggestion.
In my real code, I had a function return a matrix of variable size. I tried a number of things there, including firstprivate, make the allocatable variables threadprivate with copyin, etc, but they all failed. In the end, I found a workaround by replacing the function by a subroutine that explicitly allocates the (initially deallocated) variable, and by deallocating the variable at the end of each loop iteration.
My conclusion is that the combination of OpenMP and automatic lhs reallocation is currently poorly implemented. The code above is merely a trivial reproducer.