Please consider the following minimal Fortran program:
program ft implicit none integer :: i, j, n double complex, allocatable :: a(:, :), z(:, :), t(:, :) n=1400 allocate(a(n, n)) allocate(z(n, n)) allocate(t(n, n)) a = cmplx(1.0d0, -2.0d0) z = transpose(conjg(a)) ! t = conjg(a) ! z = transpose(t) end program ft
I find that this code gives a seg fault when compiled with ifort (now using 17.0.4 20170411, also tried with 15), but does not seg fault with gfortran. The seg fault is caused by the line
z = transpose(conjg(a))
However, if you comment this line and uncomment the next two lines, which do the same thing in two separate steps, the code runs without problems. The same behaviour is observed if using dconjg instead of conjg.
Some investigation also shows that small 2D arrays do not seg fault with ifort (and the resulting conjugate transpose array z gives the correct result), but when n becomes too large the code starts seg faulting.
If anyone could help me understand this behaviour I would be very grateful.
Thank you very much.
Intel uses stack for temporary variables - your function calls require temporary copies of very large arrays and you exceed stack.