Silverfrost Forums

Welcome to our forums

Transpose + reshape + array constructor + CMPLX real part

23 Feb 2023 2:40 #29956

The following code runs correctly when compiled under Win32. A runtime error occurs when complied under x64.

program test
use iso_fortran_env
implicit none 
complex  y(2,2) 
integer :: m = 2, i, j
print*, compiler_version()
print*, compiler_options()
y = transpose(reshape([(1),(2),(3),(4)],shape(y)))   ! This line causes runtime error when compiled with X64
do i = 1, m
  print*, (y(i,j),j=1,m)
end do
end

If line 8 is changed to:

y = transpose(reshape([(1,0),(2,0),(3,0),(4,0)],shape(y)))

or

y = transpose(reshape([cmplx(1,0),cmplx(2,0),cmplx(3,0),cmplx(4,0)],shape(y)))

The run time error does not occur. (I using the most recent update i.e. FTN v 8.96

23 Feb 2023 4:28 #29957

Ken

Thank you for the bug report. I will make a note that this needs fixing.

24 Feb 2023 9:11 #29958

Paul,

This may assist. If line 8 is changed to:

y = transpose(reshape([1,2,3,4],[2,2]))

i.e. the call to shape(y) is removed, under X64 the program does not crash, but the results in y are incorrect.

19 Apr 2023 10:13 #30205

This bug has now been fixed for the next release of clearwin64.dll.

Please login to reply.