Thank you Ron. I had not realised that list-directed io was free to put a newline between two character variables separated only by a comma. But an additional test made me suspect an ifort bug. The following program won’t compile with ifort but it compiles and runs if the len in it is replaced by len_trim .
program test3
use iso_fortran_env, only: compiler_version
character(:),allocatable:: stuff
stuff = repeat('%',len(compiler_version()))
print *,'percent = ',stuff
print *,'version = ',compiler_version()
end program test3
The error message:
test3.f90(4): error #6264: This operator is invalid in a constant expression evaluation. [LEN]
stuff = repeat('%',len(compiler_version()))
---------------------^
compilation aborted for test3.f90 (code 1)
I do not see why len is invalid in that executable statement. Gfortran allows it.
By the way ifort’s error message, which I had put between triple back-quotes, was truncated by Fortran Discourse. After ‘expression’ the first line continued with ‘evaluation. [LEN]’