stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[Help] Maybe a bug that will affect `stdlib_io:open`: open files with `access=stream` in gfortran.

Open zoziha opened this issue 4 years ago • 1 comments

Description

The following example can get our expected results on ifort, but in the case of gfortran with access=stream, for the characters in the output example (A10>A2), unexpected encoding will occur! This may affect the use of the open function in stdlib_io with gfortran, which uses access=stream.

Demo: Characters output

program main

    open (2, file="2.txt", access="stream", form="formatted")
    write(2, "(2A10)") "12","34"
    close(2)

    open (3, file="3.txt", access="sequential", form="formatted")
    write(3, "(2A10)") "12","34"
    close(3)

end program main

Run results on my laptop (windows10, msys2 ucrt64-gfortran 10.3)

2.txt

        12343.txts        343.txtseq

3.txt

        12        34

Expected Behaviour

In the above example, I think access should output consistent results in both sequential and stream cases. ifort is like this, gfortran unexpectedly garbled when access=stream.

Version of stdlib

8bfcdf9fdf8d3d897eee76512ba5083ecab29f96

Platform and Architecture

Windows 10, msys2 ucrt64-gfortran 10.3

Additional Information

I think this should be a bug. If so, do we need to report to gfortran?

zoziha avatar Sep 19 '21 15:09 zoziha

See https://gcc.gnu.org/bugs/ for details on reporting bugs to GCC. You can create an account at https://gcc.gnu.org/bugzilla/ to file the actual bugreport or reach out to the developers on the mailing list: https://gcc.gnu.org/mailman/listinfo/fortran.

awvwgk avatar Sep 19 '21 15:09 awvwgk