This post is clearly related to another one at MPI scatterv crashing for large N occasionally but I have removed all mention of MPI.
I am using the Intel compilers (ifort and ifx) from Intel OneAPI from the command line in Windows.
If I include the line B = transpose(B)
in the following code then it will fail with
forrtl: severe (170): Program Exception - stack overflow
Image PC Routine Line Source
temp.exe 00007FF653091D67 Unknown Unknown Unknown
temp.exe 00007FF653061216 Unknown Unknown Unknown
temp.exe 00007FF653091B8E Unknown Unknown Unknown
temp.exe 00007FF653091F70 Unknown Unknown Unknown
KERNEL32.DLL 00007FFCA5547614 Unknown Unknown Unknown
ntdll.dll 00007FFCA5BE26B1 Unknown Unknown Unknown
If I replace with the line B1 = transpose(B)
then it is fine.
If I reduce M (experiment suggests M <= 358 on my system) then it is fine.
If I use gfortran instead of intel compilers then it is fine.
So, is there anything fundamentally wrong with the following code?
program crash
implicit none
integer, parameter::dp = kind( 1.d0 )
integer, parameter :: M = 1000, N = M, O = M ! Matrix dimension (works OK up to M=358)
! real(dp) B(N,O), B1(N,O)
real(dp), allocatable :: B(:,:), B1(:,:)
allocate( B(N,O), B1(N,O) )
B = 0
B = transpose(B) ! this fails with ifort and ifx under windows; it's fine with gfortran
! B1 = transpose(B) ! but this is fine
end program crash
To check compiler commands and version, here are the gruesome details: