Skip to content

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

Closed
@zoziha

Description

@zoziha

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

8bfcdf9

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompiler: gfortranSpecific to GCC Fortran compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions