public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/52539] New: I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write
@ 2012-03-09 10:20 burnus at gcc dot gnu.org
  2012-03-10 14:33 ` [Bug libfortran/52539] " jvdelisle at gcc dot gnu.org
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-09 10:20 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2014-06-07 17:53 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 10:20 [Bug libfortran/52539] New: I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write burnus at gcc dot gnu.org
2012-03-10 14:33 ` [Bug libfortran/52539] " jvdelisle at gcc dot gnu.org
2012-03-10 14:53 ` burnus at gcc dot gnu.org
2014-01-16  8:30 ` dominiq at lps dot ens.fr
2014-03-28 18:52 ` jvdelisle at gcc dot gnu.org
2014-03-28 22:00 ` jvdelisle at gcc dot gnu.org
2014-03-28 23:50 ` jvdelisle at gcc dot gnu.org
2014-04-26 21:57 ` jvdelisle at gcc dot gnu.org
2014-04-27 10:48 ` schwab@linux-m68k.org
2014-04-27 11:14 ` schwab@linux-m68k.org
2014-04-27 11:20 ` schwab@linux-m68k.org
2014-04-27 11:38 ` burnus at gcc dot gnu.org
2014-04-27 11:59 ` schwab@linux-m68k.org
2014-04-27 12:48 ` burnus at gcc dot gnu.org
2014-04-27 14:56 ` jvdelisle at gcc dot gnu.org
2014-04-27 15:12 ` burnus at gcc dot gnu.org
2014-04-27 17:41 ` jvdelisle at gcc dot gnu.org
2014-05-03  3:31 ` jvdelisle at gcc dot gnu.org
2014-05-03 18:38 ` dominiq at lps dot ens.fr
2014-05-03 18:56 ` jvdelisle at gcc dot gnu.org
2014-05-03 20:48 ` dominiq at lps dot ens.fr
2014-05-05  9:08 ` dominiq at lps dot ens.fr
2014-05-08  4:08 ` jvdelisle at gcc dot gnu.org
2014-05-08  5:18 ` jvdelisle at gcc dot gnu.org
2014-05-18  2:31 ` jvdelisle at gcc dot gnu.org
2014-05-18  2:34 ` jvdelisle at gcc dot gnu.org
2014-05-19  7:05 ` burnus at gcc dot gnu.org
2014-06-07 17:53 ` jvdelisle at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).