Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29267 Discussions

Change of behaviour for internal write statement

Dalziel__Stuart
Beginner
420 Views

There seems to be a change in behaviour with the '*' format in internal write statements. Is this intentional?

In particlar, the following code executes differently (and in my view incorrectly) with XE Update 1 from the behaviour under CVF or IVF 9 through to 11:

[fxfortran]program Console1
integer (4), automatic :: k
character (8), automatic :: String

String = ' '

! The following internal write statements are fine
write(String,'(A)')'ABCD'
write(*,*)((':',String(k:k)),k=1,5),':'

write(String(1:2),'(A)') 'E'//'F'
write(*,*)((':',String(k:k)),k=1,5),':'

write(String(3:4),'(A,A)') 'G','H' 
write(*,*)((':',String(k:k)),k=1,5),':'

! The following has an incorrect leading space
String = 'XXXXX'
write(String,*)'ABCD'
write(*,*)((':',String(k:k)),k=1,5),':'

! The leading space causes the following to fail
write(String(1:2),*)'EF'
write(String(3:4),*)'G','H'

end program Console1

[/fxfortran]


Is it that the internal write is now putting Fortran carriage control characters in the first character with the '*' format? Can this be turned off globally?

0 Kudos
1 Reply
Steven_L_Intel1
Employee
420 Views
The leading space is required by the standard for list-directed output. If we were not putting one in there before, it was a bug. The exact wording of the standard is "Except for continuation of delimited character sequences, each output record begins with a blank character."

I strongly recommend against using list-directed formatting when you care about the exact formatting.
0 Kudos
Reply