This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/52539] I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 May 2014 09:08:42 +0000
- Subject: [Bug libfortran/52539] I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write
- Auto-submitted: auto-generated
- References: <bug-52539-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52539
--- Comment #24 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
On powerpc-apple-darwin9 with the patch in comment 20, the test
gfortran.dg/namelist_utf8.f90 fails. The following modified test
[karma] f90/bug% cat > pr52539_2_db.f90
! { dg-do run }
! PR52539 UTF-8 support for namelist read and write
character(len=10, kind=4) :: str, str2
character(len=25, kind=4) :: str3
namelist /nml/ str
str = 4_'1a'//char (int (z'4F60'),4) &
//char (int (z'597D'), 4)//4_'b'
open(6, encoding='utf-8')
open(99, encoding='utf-8',form='formatted')
write(99, '(3a)') '&nml str = "', str, '" /'
write(99, '(a)') str
rewind(99)
str = 4_'XXXX'
str2 = 4_'YYYY'
read(99,nml=nml)
read(99, *) str2
print *, "'", str, "' '", str2, "'"
!if (str2 /= str) call abort
rewind(99)
read(99,'(A)') str3
print *, "'", str, "' '", str3, "'"
if (str3 /= 4_'&nml str = "' // str // 4_'" /') call abort
read(99,'(A)') str3
if (str3 /= str) call abort
close(99, status='delete')
end
gives
'??????????????????X ' '1aÃÂÂÃÂÂb '
'??????????????????X ' '&nml str = "1aäåb " /'
Program aborted. Backtrace:
#0 0xeee9b
Abort
while the file fort.99 is
&nml str = "1aäåb " /
1aäåb