This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR fortran/23815: Add byte-swapping to gfortran


On Wed, Nov 16, 2005 at 01:30:33PM -0800, Richard Henderson wrote:
> On Wed, Nov 16, 2005 at 10:18:42PM +0100, Thomas Koenig wrote:
> > In the short term, should I settle for straight byte reversal and
> > hope for the best on the 12/16 size issue?
> 
> Yes.

Here we go.

I made another change:  CONVERT is only flagged with a warning on
-pedantic.

Regression-tested on i686-pc-linux-gnu.  Documentation checked with
"make dvi".  OK for mainline?

	Thomas

2005-11-16  Thomas Koenig  <Thomas.Koenig@online.de>

	PR fortran/23815
	* io.c (top level):  Add convert to io_tag.
	(resolve_tag):  convert is GFC_STD_GNU.
	(match_open_element):  Add convert.
	(gfc_free_open):  Likewise.
	(gfc_resolve_open):  Likewise.
	(gfc_free_inquire):  Likewise.
	(match_inquire_element):  Likewise.
	* dump-parse-tree.c (gfc_show_code_node):  Add
	convet for open and inquire.
	gfortran.h: Add convert to gfc_open and gfc_inquire.
	* trans-io.c (top level):  Add ioparm_convert and
	ioparm_convert_len.
	Add convert to ioparm structure.
	(gfc_trans_open):  Add convert.
	(gfc_trans_inquire):  Likewise.
	* gfortran.texi:  Document CONVERT.

2005-11-16  Thomas Koenig  <Thomas.Koenig@online.de>

	PR fortran/23815
	* io/file_pos.c (unformatted_backspace):  If flags.convert
	does not equal CONVERT_NATIVE, reverse the record marker.
	* io/open.c:  Add convert_opt[].
	(st_open):  If no convert option is given, set CONVERT_NATIVE.
	If CONVERT_BIG or CONVERT_LITTLE are given, set flags.convert to
	CONVERT_NATIVE or CONVERT_SWAP (depending on wether we have
	a big- or little-endian system).
	* io/transfer.c (unformatted_read): Remove "unused" attribute from
	arguments.  If we need to reverse bytes, break up large transfers
	into a loop.  Split complex numbers into its two parts.
	(unformatted_write):  Likewise.
	(us_read):  If flags.convert does not equal CONVERT_NATIVE,
	reverse the record marker.
	(next_record_w): Likewise.
	(reverse_memcpy):  New function.
	* io/inquire.c (inquire_via_unit):  Implement convert.
	* io/io.h (top level):  Add unit_convert.
	Add convert to ioparm.  Add convert to unit_flags.
	Declare reverse_memcpy().

2005-11-16  Thomas Koenig  <Thomas.Koenig@online.de>

	PR fortran/23815
	* gfortran.dg/unf_io_convert_1.f90:  New test.
	* gfortran.dg/unf_io_convert_2.f90:  New test.
	* gfortran.dg/unf_io_convert_3.f90:  New test.
	

Attachment: byteswap-5.diff
Description: Text document

Attachment: unf_io_convert_1.f90
Description: Text document

Attachment: unf_io_convert_2.f90
Description: Text document

Attachment: unf_io_convert_3.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]