Currently the Fortran front end does not recognize an internal unit of KIND=4. Fixing this is a follow up to the UTF-8 patch.
I am back on this.
Patch: http://gcc.gnu.org/ml/fortran/2010-07/msg00113.html
Subject: Bug 37077 Author: jvdelisle Date: Tue Jul 13 02:07:48 2010 New Revision: 162122 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162122 Log: 2010-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/37077 * trans-io.c (build_dt): Set common.unit to flag chracter(kind=4) internal unit. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-io.c
Subject: Bug 37077 Author: jvdelisle Date: Tue Jul 13 02:12:08 2010 New Revision: 162123 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162123 Log: 2010-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37077 * io/read.c: Fix comment. * io/io.h (is_char4_unit): New macro. * io/unit.c (get_internal_unit): Call new function open_internal4. * io/unix.c (mem_alloc_r4): New function. (mem_alloc_w4): New function. (mem_read4): New function, temporary stub. (mem_write4): New function. (open_internal4): New function to set stream pointers to use the new mem functions. * io/transfer.c (write_block): Use new mem_alloc_w4 to access internal units of kind=4. * io/unix.h: Add prototypes for open_internal4, mem_alloc_w4, and mem_alloc_r4. * io/write.c (memset4): New helper function. (memcpy4): New helper function. (write_default_char4): Use new helper functions. (write_a): Likewise. (write_l): Likewise. (write_boz): Likewise. (write_decimal): Likewise. (write_x): Likewise. (write_integer): Likewise. * io/write_float.def (output_float): Add code blocks to handle internal unit kind=4 output utilizing gfc_char4_t pointers. (write_infnan): Use new helper functions. (OUTPUT_FLOAT_FMT_G): Update this macro likewise. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/io.h trunk/libgfortran/io/read.c trunk/libgfortran/io/transfer.c trunk/libgfortran/io/unit.c trunk/libgfortran/io/unix.c trunk/libgfortran/io/unix.h trunk/libgfortran/io/write.c trunk/libgfortran/io/write_float.def
Subject: Bug 37077 Author: jvdelisle Date: Tue Jul 13 02:16:29 2010 New Revision: 162124 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162124 Log: 2010-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37077 * gfortran.dg/char4_iunit_1.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/char4_iunit_1.f03 Modified: trunk/gcc/testsuite/ChangeLog
As an update. I have READ from character(kind=4) working. I am also going to complete list directed write of character and combine that. write(widestring,*) "test" does not work yet.
Subject: Bug 37077 Author: jvdelisle Date: Fri Jul 16 14:16:04 2010 New Revision: 162260 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162260 Log: 2010-07-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37077 * io/read.c (read_default_char4): Add support for reading into a kind-4 character variable from a character(kind=4) internal unit. * io/io.h (read_block_form4): Add prototype. * io/unit.c (get_internal_unit): Add call to fbuf_init. (free_internal_unit): Add call to fbuf_destroy. (get_unit): Fix whitespace. * io/transfer.c (read_sf_internal): Use fbuf_alloc to allocate a string to recieve the wide characters translated to single byte chracters. (read_block_form): Fix whitespace. (read_block_form4): New function to read from a character(kind=4) internal unit into a character(kind=4) variable. (read_block_direct): Fix whitespace. (write_block): Fix whitespace. (formatted_transfer_scalar_read): Likewise. (formatted_transfer_scalar_write): Likewise. * io/write.c (write_character): Add support for list directed write of a kind=1 character string to a character(kind=4) internal unit. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/io.h trunk/libgfortran/io/read.c trunk/libgfortran/io/transfer.c trunk/libgfortran/io/unit.c trunk/libgfortran/io/write.c
Subject: Bug 37077 Author: jvdelisle Date: Fri Jul 16 14:21:10 2010 New Revision: 162261 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162261 Log: 2010-07-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37077 * gfortran.dg/char4_iunit_2.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/char4_iunit_2.f03 Modified: trunk/gcc/testsuite/ChangeLog
Done.