This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/52539] New: I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Mar 2012 10:19:44 +0000
- Subject: [Bug libfortran/52539] New: I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52539
Bug #: 52539
Summary: I/O: Wrong result for UTF-8/UCS-4 list-directed and
namelist read and nml write
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: jvdelisle@gcc.gnu.org
Example using UTF-8 string with UCS-4 character variables; the string contains
(a)(ni)(hao)(b) ("aäå").
The following program prints here the following. One sees that list-directed
writing correctly works but namelist writing doesn't. (Also the fort.99
contains the correct string.)
For reading, neither list-directed reading nor namelist reading works.
Looking at list_read.c, UTF-8 seems to be unhandled. (And in nml_get_obj_data,
the "array_loop_spec ind" initialization won't survive the array descriptor
reform unmodified.)
>aäå< ! << OK
>aäå< ! << OK
&NML
STR="a", ! << WRONG
/
>ïïïïïXX< ! << WRONG
>ïïïïïXX< ! << WRONG
&NML
STR="aïï", ! << WRONG
/
>aÃÂ< ! << WRONG
>aÃÂ< ! << WRONG
character(len=3, kind=4) :: str, str2
namelist /nml/ str
str = 4_'a'//char (int (z'4F60'),4) &
//char (int (z'597D'), 4)//4_'b'
open(6, encoding='utf-8')
write(*, '(a)') 4_'>'//str//4_'<'
write(*, *) 4_'>'//str//4_'<'
write(*,nml=nml)
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
close(99, status='delete')
write(*, '(a)') 4_'>'//str//4_'<'
write(*, *) 4_'>'//str//4_'<'
write(*,nml=nml)
write(*, *) 4_'>'//str2//4_'<'
write(*, '(a)') 4_'>'//str2//4_'<'
end