My compiler is GNU Fortran on Windows 10. Details at the bottom.
If I run this:
program tab_newline_problem_with_gfortran
implicit none
character(len=128) :: str
write (str,101) ': This is the first line.'//NEW_LINE('A'), &
' '// &
'This is the second line.'
101 format (A,A)
stop str
end program tab_newline_problem_with_gfortran
then I get this:
STOP : This is the first line.
This is the second line.
which is what I expect.
However, if I remove the leading whitespace string for the second output line and instead insert a T7 tab format specifier like this:
program tab_newline_problem_with_gfortran
implicit none
character(len=128) :: str
write (str,101) ': This is the first line.'//NEW_LINE('A'), &
'This is the second line.'
101 format (A,T7,A)
stop str
end program tab_newline_problem_with_gfortran
then I get this unexpected output:
STOP : ThisThis is the second line.
In addition if, instead of using NEW_LINE(), I use the “/” newline format specifier, like this:
program tab_newline_problem_with_gfortran
implicit none
character(len=128) :: str
write (str,101) ': This is the first line.', &
'This is the second line.'
101 format (A,/,A)
stop str
end program tab_newline_problem_with_gfortran
then I get this runtime error:
At line 7 of file tab_newline_problem_with_gfortran.f90
Fortran runtime error: End of file
Can someone please explain?
GNU Fortran (MinGW.org GCC-6.3.0-1) 6.3.0
OS Name: Microsoft Windows 10 Pro Education
OS Version: 10.0.19045 N/A Build 19045
System Model: Latitude 3190
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 122 Stepping 8 GenuineIntel ~1101 Mhz
BIOS Version: Dell Inc. 1.15.2, 29/07/2021