Consider the following code:
program test implicit none character(len=5) :: s(3), sr(3,1) s(1) = '12345' s(2) = 'ABCDE' s(3) = 'abcde' ! everything fine here sr = reshape(s,(/3,1/)) write(*,*) 'len is ',len(sr) write(*,*) 'shape is ',shape(sr) write(*,*) 'sr is ',sr write(*,*) '' ! this should be the same as before, but len is lost associate( ar => reshape(s,(/3,1/)) ) write(*,*) 'len is ',len(ar) write(*,*) 'shape is ',shape(ar) write(*,*) 'ar is ',ar end associate end program test
The output of the WRITEs inside the ASSOCIATE construct should be the same as the previous one, however I get
$ ./test
len is 5
shape is 3 1
sr is 12345ABCDEabcde
len is 0
shape is 3 1
ar is
i.e. the length of ar is zero, which I think is wrong.
$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0 Build 20140723
Marco