[Bug libfortran/98825] Unexpected behavior of FORTRAN FORMAT expressions when suppressing new line with '$'

max.pd at gmx dot de gcc-bugzilla@gcc.gnu.org
Wed Jan 27 16:40:31 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98825

--- Comment #5 from max.pd at gmx dot de ---
The -fdec compiler flag provides a possible work around. When opening a Unit
with CARRIAGECONTROL='NONE' (an option available with DEC extensions in
gfortran), the program won't show the unexpected behavior any more. But there
would be no way to enable the carriage return between records for that io-unit
omitting '$' in the format expression. This work around makes it necessary to
open a new unit for stdout output:

       OPEN (UNIT=7, FILE='/dev/stdout', CARRIAGECONTROL='NONE')

 This feature is documented in:

https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/Extended-I_002fO-specifiers.html

The '$'-fin format works well for gfortran on single records without any
compiler flags. So it might be coherent, to make a patch, that affects the full
scope of the '$' format expressions, even those compiled without the -fdec
compiler flags. So the patch would cover all possible occurrences of the
unexpected behavior when writing multiple record output.


More information about the Gcc-bugs mailing list