I am using Fortran Compiler XE 15.0.1.148 .
When I compile and run the following simple program in Debug mode, it runs fine without any errors or warnings. However, it crashes if I compile it in optimized Release mode. I can prevent it from crashing if I disable the /Qopenmp option. My guess is that the problem has something to do with having a derived type variable declared as private in OpenMP loop.
program test_derived_type implicit none type T integer,allocatable:: a(:) end type T type(T):: b integer i, s s = 0 !$OMP parallel do default(none), schedule(dynamic), & !$OMP& private(i,b), reduction(+:s) do i = 1, 100 print*, i allocate( b%a(i) ) b%a = 1 s = s + sum(b%a) deallocate(b%a) end do ! i !$OMP end parallel do write(*,*) 's =', s stop end program test_derived_type