From http://gcc.gnu.org/ml/fortran/2008-10/msg00045.html : $ cat foo.f90 character(len=16) :: string, string2 string='BIG_ENDIAN' open(unit=13,form='unformatted',file='gftest.dat',convert='big_endian',status='UNKNOWN') write(13) string close(13) end $ gfortran foo.f90 $ ./a.out $ od -t x1 -t a gftest.dat 0000000 00 00 00 10 20 20 20 20 20 20 4e 41 49 44 4e 45 nul nul nul dle sp sp sp sp sp sp N A I D N E 0000020 5f 47 49 42 00 00 00 10 _ G I B nul nul nul dle 0000030
Thomas, any ideas and do you have time to investigate this?
(In reply to comment #1) > Thomas, any ideas and do you have time to investigate this? The problem is right at the beginning of write_unformatted and read_unformatted. I think we need to select the normal write/read on kind==1, not on size==1, but I will need to do some more thinking on this.
Subject: Bug 37753 Author: tkoenig Date: Thu Oct 9 19:28:58 2008 New Revision: 141008 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141008 Log: 2008-10-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/37753 * io/transfer.c (unformatted_read): CONVERT_NATIVE is the usual case. Check for kind==1 for non-byte-reversing operation. (unformatted_write): Likewise. 2008-10-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/37753 * gfortran.dg/convert_2.f90: New test case. Added: trunk/gcc/testsuite/gfortran.dg/convert_2.f90 Modified: trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/io/transfer.c
Fixed. Closing.