Bug 37077 - Implement Internal Unit I/O for character KIND=4
Summary: Implement Internal Unit I/O for character KIND=4
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Jerry DeLisle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-11 05:12 UTC by Jerry DeLisle
Modified: 2010-07-20 01:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-06-30 04:26:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerry DeLisle 2008-08-11 05:12:36 UTC
 
Comment 1 Jerry DeLisle 2008-08-11 05:14:10 UTC
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.
Comment 2 Jerry DeLisle 2010-06-30 04:26:03 UTC
I am back on this.
Comment 3 Tobias Burnus 2010-07-12 07:54:45 UTC
Patch: http://gcc.gnu.org/ml/fortran/2010-07/msg00113.html
Comment 4 Jerry DeLisle 2010-07-13 02:08:09 UTC
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

Comment 5 Jerry DeLisle 2010-07-13 02:12:23 UTC
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

Comment 6 Jerry DeLisle 2010-07-13 02:16:44 UTC
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

Comment 7 Jerry DeLisle 2010-07-16 05:39:30 UTC
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.
Comment 8 Jerry DeLisle 2010-07-16 14:16:38 UTC
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

Comment 9 Jerry DeLisle 2010-07-16 14:21:34 UTC
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

Comment 10 Jerry DeLisle 2010-07-20 01:09:21 UTC
Done.