Hi all,
the following code writes an incorrect result:
program p implicit none call fs((/"abc","d "/)) contains subroutine fs(text) character(len=*), intent(in) :: text(:) integer :: i write(*,*) "size(text) = ", size(text) write(*,*) "len_trim = ", (len_trim(text(i)) , i=1,size(text)) write(*,*) "sum(...) = ", sum((/(len_trim(text(i)) , i=1,size(text))/)) end subroutine fs end program p
Using "Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.181 Build 20160204" I get
size(text) = 2 len_trim = 3 1 sum(...) = 259
where I would expect, for sum(...), 4.
This might also be related to this old post: https://software.intel.com/en-us/comment/1878150#comment-1878150 .