Commit Graph

280 Commits

Author SHA1 Message Date
Thomas Koenig b4c811bd14 re PR libfortran/30009 ([4.1 only] Unformatted reads exceeding storage units gives EOF instead of ERR)
2006-12-06  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/30009
	PR libfortran/30056
	* gfortran.dg/read_eof_4.f90:  Add tests.
	* gfortran.dg/readwrite_unf_direct_eor_1.f90:  New test.
	* gfortran.dg/unf_read_corrupted_1.f90: New test.

2006-12-06  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/30009
	PR libfortran/30056
	* libgfortran.h:  Add ERROR_CORRUPT_FILE to error_codes.
	* runtime/error.c (translate_error):  Add handling for
	ERROR_CORRUPT_FILE.
	* io/transfer.c (read_block_direct):  Add comment about
	EOR for stream files.
	Remove test for no bytes left for direct access files.
	Generate an ERROR_SHORT_RECORD if the read was short.
	For unformatted sequential files:  Check endfile condition.
	Remove test for no bytes left.  End of file here means
	that the file structure has been corrupted.  Pre-position
	the file for the next record in case of error.
	(write_buf):  Whitespace fix.  Subtract the number of bytes
	written from bytes_left.

From-SVN: r119592
2006-12-06 19:25:44 +00:00
Jerry DeLisle db7317c3cf re PR libfortran/30005 (Open errors (not/already exists etc.): show also the file name)
2006-12-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/30005
	* io/open.c: Add errno.h include.
	(new_unit): Add new error messages with file name for file open.

From-SVN: r119530
2006-12-05 00:51:26 +00:00
Thomas Koenig 07b3bbf200 re PR libfortran/29568 (implement unformatted files with subrecords (Intel style))
2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* gfortran.dg/convert_implied_open.f90:  Change to
	new default record length.
	* gfortran.dg/unf_short_record_1.f90:  Adapt to
	new error message.
	* gfortran.dg/unformatted_subrecords_1.f90:  New test.

2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* gfortran.h (gfc_option_t):  Add max_subrecord_length.
	(top level): Define MAX_SUBRECORD_LENGTH.
	* lang.opt:  Add option -fmax-subrecord-length=.
	* trans-decl.c:  Add new function set_max_subrecord_length.
	(gfc_generate_function_code): If we are within the main
	program and max_subrecord_length has been set, call
	set_max_subrecord_length.
	* options.c (gfc_init_options):  Add defaults for
	max_subrecord_lenght, convert and record_marker.
	(gfc_handle_option):  Add handling for
	-fmax_subrecord_length.
	* invoke.texi:  Document the new default for
	-frecord-marker=<n>.

2006-12-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29568
	* libgfortran/libgfortran.h (compile_options_t):  Add
	record_marker. (top level):  Define GFC_MAX_SUBRECORD_LENGTH.
	* runtime/compile_options.c (set_record_marker):  Change
	default to four-byte record marker.
	(set_max_subrecord_length):  New function.
	* runtime/error.c (translate_error):  Change error message
	for short record on unformatted read.
	* io/io.h (gfc_unit):  Add recl_subrecord, bytes_left_subrecord
	and continued.
	* io/file_pos.c (unformatted_backspace):  Change default of record
	marker size to four bytes.  Loop over subrecords.
	* io/open.c:  Default recl is max_offset.  If
	compile_options.max_subrecord_length has been set, set set
	u->recl_subrecord to its value, to the maximum value otherwise.
	* io/transfer.c (top level):  Add prototypes for us_read, us_write,
	next_record_r_unf and next_record_w_unf.
	(read_block_direct):  Separate codepaths for unformatted direct
	and unformatted sequential.  If a recl has been set by the
	user, use the number of bytes left for the record if it is smaller
	than the read request.  Loop over subrecords.  Set an error if the
	user has set a recl and the read was short.
	(write_buf):  Separate codepaths for unformatted direct and
	unformatted sequential. If a recl has been set by the
	user, use the number of bytes left for the record if it is smaller
	than the read request.  Loop over subrecords.  Set an error if the
	user has set a recl and the read was short.
	(us_read):  Add parameter continued (to indicate that bytes_left
	should not be intialized).  Change default of record marker size
	to four bytes. Use subrecord.  If the subrecord length is smaller than
	zero, this indicates a continuation.
	(us_write):  Add parameter continued (to indicate that the continued
	flag should be set).  Use subrecord.
	(pre_position):  Use 0 for continued on us_write and us_read calls.
	(skip_record):  New function.
	(next_record_r_unf):  New function.
	(next_record_r):  Use next_record_r_unf.
	(write_us_marker):  Default size for record markers is four bytes.
	(next_record_w_unf):  New function.
	(next_record_w):  Use next_record_w_unf.

From-SVN: r119412
2006-12-01 21:04:38 +00:00
Jerry DeLisle b0c6db58ad io.h (unit_flags): Add new flag has_recl.
2006-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/io.h (unit_flags): Add new flag has_recl.
	* io.open.c (new_unit): Set flag if RECL= was specified.
	* io/transfer.c (us_write): If flag set, leave recl as initialized by
	new_unit.

From-SVN: r119087
2006-11-22 07:32:09 +00:00
François-Xavier Coudert 6c0e51c4fa trans-decl.c (gfc_get_symbol_decl): Fix formatting.
* trans-decl.c (gfc_get_symbol_decl): Fix formatting.

	* io/open.c (new_unit): Format %d expects an int variable.
	* runtime/error.c (show_locus): Format %d expects an int variable.

From-SVN: r118887
2006-11-16 11:20:57 +00:00
Steven G. Kargl 474e88dd75 2006-11-08 Steven G. Kargl <kargl@gcc.gnu.org>
* io/read. (max_value): Hide "int n" in an #ifdef.

From-SVN: r118613
2006-11-09 03:57:44 +00:00
Jerry DeLisle 54938c1127 re PR fortran/29752 (write(*,*,advance='NO'), READ(): Data not flushed)
2006-11-08  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29752
	* io/transfer.c (finalize_transfer): Flush on ADVANCE_NO.

From-SVN: r118611
2006-11-09 03:03:40 +00:00
Jerry DeLisle d5fe3b0ea9 transfer.c (next_record_w): Fix indentation.
2006-11-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/transfer.c (next_record_w): Fix indentation.

From-SVN: r118508
2006-11-05 17:54:17 +00:00
Jerry DeLisle 97cd182da7 re PR libfortran/25545 (internal file and dollar edit descriptor)
2006-11-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25545
	* io/transfer.c (write_block): Cleanup code paths between
	stream and non-stream I/O.
	(write_buf):  Cleanup.
	(read_block): Cleanup.
	(finalize_transfer): Call next_record for '$' edit descriptor handling
	of internal unit. Cleanup code for readability.

From-SVN: r118506
2006-11-05 17:35:30 +00:00
Thomas Koenig 8a7f7fb6de re PR libfortran/29627 ([4.1 only] partial unformatted reads shouldn't succeed)
2006-10-31  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29627
	* libgfortran.h: Add ERROR_SHORT_RECORD
	* runtime/error.c (translate_error): Add case
	for ERROR_SHORT_RECORD.
	* io/transfer.c (read_block_direct):  Separate codepaths
	for stream and record unformatted I/O.  Remove unneeded
	tests for standard input, padding and formatted I/O.
	If the record is short, read in as much data as possible,
	then raise the error.

2006-10-31  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/29627
	* gfortran.dg/unf_short_record_1.f90:  New test.

From-SVN: r118341
2006-10-31 20:58:26 +00:00
Tobias Burnus 751748ff5a re PR fortran/29625 (Octal edit descriptors allow real variables, even with -std=f95)
2006-10-28 Tobias Burnus <burnus@net-b.de>

	PR fortran/29625
	* io/transfer.c (formatted_transfer_scalar): Allow binary edit
	  descriptors for real variables; give error for BOZ edit
	  descriptor for non-integers when using -std=f*.

From-SVN: r118111
2006-10-28 23:05:42 +02:00
Jerry DeLisle bbd6c8aa76 re PR fortran/29563 (Internal read loses data.)
2006-10-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29563
	* io/list_read.c (next_char): Fix an error in previous commit.

From-SVN: r118063
2006-10-26 07:17:21 +00:00
Jerry DeLisle 807fb853ee re PR fortran/29563 (Internal read loses data.)
2006-10-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29563
	* io/io.h (st_parameter_dt): Add new flag at_eof.
	* io/list_read.c (next_char): Set flag when EOF and return '\n' to
	signal EOR.  Check flag on next call and jump out.
	* io/unit.c (get_internal_unit): Initialize new flag.

From-SVN: r118059
2006-10-26 04:35:45 +00:00
Jerry DeLisle 9e7fc6b946 re PR fortran/29277 (Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms)
2006-10-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29277
	* io/write.c (write_a): Add conversion of LF to CR-LF for systems with
	#define HAVE_CRLF.

From-SVN: r117866
2006-10-18 23:13:33 +00:00
Tobias Burnus 8b6dba81f0 in_pack.m4: Fixed a typo.
2006-10-16  Tobias Burnus  <burnus@net-b.de>

        * m4/in_pack.m4: Fixed a typo.
        * m4/iforeach.m4: Fixed a typo.
        * m4/eoshift1.m4: Fixed a typo.
        * m4/eoshift3.m4: Fixed a typo.
        * m4/cshift1.m4: Fixed a typo.
        * m4/in_unpack.m4: Fixed a typo.
        * m4/reshape.m4: Fixed a typo.
        * m4/ifunction.m4: Fixed a typo.
        * runtime/environ.c: Fixed a typo.
        * runtime/in_pack_generic.c: Fixed a typo.
        * runtime/in_unpack_generic.c: Fixed a typo.
        * runtime/memory.c: Fixed a typo.
        * intrinsics/cshift0.c: Fixed a typo.
        * intrinsics/cpu_time.c: Fixed a typo.
        * intrinsics/pack_generic.c: Fixed a typo.
        * intrinsics/unpack_generic.c: Fixed a typo.
        * intrinsics/eoshift0.c: Fixed a typo.
        * intrinsics/eoshift2.c: Fixed a typo.
        * intrinsics/reshape_generic.c: Fixed a typo.
        * io/open.c: Fixed a typo.
        * io/list_read.c: Fixed a typo.
        * io/io.h: Fixed a typo.
        * io/transfer.c: Fixed a typo.
        * io/write.c: Fixed a typo.

From-SVN: r117857
2006-10-18 19:17:49 +02:00
Jerry DeLisle 09861cbee6 re PR fortran/29277 (Formated stream output: Translate "\n" / achar(10) into "\r\n" on some platforms)
2006-10-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29277
	* io/list_read.c (next_char): Update strm_pos.
	(eat_separator): Delete extra call to unget_char.
	* io/transfer.c (read_block): Use read_sf for formatted stream I/O.
	(next_record_r): Update strm_pos for formatted stream I/O and handle
	end-of-record correctly.
	(next_record_w): Ditto.
	(next_record): Enable next record (r/w) functions and update strm_pos.
	(finalize_transfer): Call next_record to finish the record.

From-SVN: r117846
2006-10-18 04:04:07 +00:00
Danny Smith 6a7c793f3e re PR libfortran/27964 (Wrong line ends on windows (XP))
PR libfortran/27964
	* configure.ac: Check for setmode() function.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* io/unix.c (output_stream): Force stdout to binary mode. 
	(error_stream): Force stderr to binary mode.

From-SVN: r117166
2006-09-23 01:56:55 +00:00
Jerry DeLisle 701306112e re PR fortran/29053 (Consecutive STREAM I/O file positions mixed up)
2006-09-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/29053
	* io.h (gfc_unit): Add variable, strm_pos, to track
	STREAM I/O file position.
	* file_pos.c (st_rewind): Set strm_pos to beginning.
	* open.c (new_unit): Initialize strm_pos.
	* read.c (read_x): Bump strm_pos.
	* inquire.c (inquire_via_unit): Return strm_pos value.
	* transfer.c (read_block),(read_block_direct),(write_block)
	(write_buf): Seek to strm_pos - 1.  Update strm_pos when done.
	(pre_position): Initialize strm_pos.
	(data_transfer_init): Set strm_pos if DT_HAS_REC.
	(finalize_transfer): Flush file, no need to update strm_pos.

From-SVN: r116970
2006-09-15 13:16:15 +00:00
Jerry DeLisle 20e1580fad re PR libfortran/28354 ([4.1 Only] 0.99999 printed as 0. instead of 1. by format(f3.0))
2006-08-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/28354
	* io/write.c: Check for special case of zero precision in format
	and pre-round the real value.

From-SVN: r116502
2006-08-28 05:14:05 +00:00
Jerry DeLisle 91b30ee5b9 re PR fortran/25828 ([f2003] ACCESS='STREAM' io support)
2006-08-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25828
	* libgfortran.h: Rename GFC_LARGE_IO_INT to GFC_IO_INT.
	* io/file_pos.c (st_backspace): Ignore if access=STREAM.
	(st_rewind): Handle case of access=STREAM.
	* io/open.c (access_opt): Add STREAM_ACCESS.
	(edit_modes): Set current_record to zero only if not STREAM.
	(new_unit): Initialize maxrec, recl, and last_record for STREAM.
	* io/read.c (read_x): Advance file position for STREAM.
	* io/io.h (enum unit_access): Align IOPARM flags with frontend.
	Add ACCESS_STREAM. Add prototype for is_stream_io () function.
	Use GFC_IO_INT.
	* io/inquire.c (inquire_via_unit): Add text for access = "STREAM".
	* io/unit.c (is_stream_io): New function to return true if access =
	STREAM.
	* io/transfer.c (file_mode): Add modes for unformatted stream and
	formatted stream. (current_mode): Return appropriate file mode based
	on access flags.
	(read_block): Handle formatted stream reads.
	(read_block_direct): Handle unformatted stream reads.
	(write_block): Handle formatted stream writes.
	(write_buf): Handle unformatted stream writes.
	(unformatted_read): Fix up, use temporary for size.
	(pre_position): Position file for STREAM access.
	(data_transfer_init): Initialize for stream access, skip irrelevent
	error checks.
	(next_record_r),(next_record_w), and (next_record): Do nothing for
	stream I/O.
	(finalize_transfer): Flush when all done if stream I/O.

From-SVN: r116172
2006-08-15 23:06:44 +00:00
Jerry DeLisle e43c3311bd re PR fortran/28335 (flush() / write() statement on closed units - error?)
2006-07-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/28335
	* file_position.c (st_flush): Add clearer error when UNIT does not
	exist. Add reference to standard in comment.

From-SVN: r115835
2006-07-31 01:32:38 +00:00
Jerry DeLisle b8d403b467 re PR fortran/28335 (flush() / write() statement on closed units - error?)
2006-07-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/28335
	* close.c (st_close): Revert previous patch and add comment.
	* file_position.c (st_flush): Revert previous patch and add comment.

From-SVN: r115829
2006-07-31 00:15:08 +00:00
Janne Blomqvist 6097a89729 transfer.c (transfer_array): Remove stride0 fix.
2006-07-30  Janne Blomqvist  <jb@gcc.gnu.org>

	* io/transfer.c (transfer_array): Remove stride0 fix.

From-SVN: r115818
2006-07-30 13:23:26 +03:00
Jerry DeLisle ca8d5bc6c6 2006-07-25 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/258335
	* close.c (st_close): Add error when UNIT does not exist.
	* file_position.c (st_flush): Add error when UNIT does not exist.

From-SVN: r115749
2006-07-26 01:40:29 +00:00
Jerry DeLisle 566ffce895 re PR libfortran/25289 (Cannot handle record numbers large than huge(0_4))
2006-07-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25289
	* libgfortran.h: Add conditional definition of GFC_LARGE_IO_INT type.
	* io/io.h (st_parameter_dt): Define rec as type GFC_LARGE_IO_INT.

From-SVN: r115698
2006-07-24 00:17:52 +00:00
Jerry DeLisle 397bc09a65 re PR fortran/28339 (gfortran misses a record from a format statement)
2006-07-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/28339
	* io/transfer.c (next_record_w): Use next_array_record result to set
	END_FILE. (write_block): Test for END_FILE before the next write occurs.
	* io/unit.c (get_internal_unit): Initialize iunit->endfile for internal
	unit.

From-SVN: r115670
2006-07-22 03:14:27 +00:00
Jerry DeLisle 2e4444278c re PR libfortran/27704 (Incorrect runtime error on multiple OPEN)
2006-07-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27704
	* runtime/error.c (notify_std): Pass common flags into function. Use
	flags to show locus of error or warning.
	* libgfortran.h: Add enum try.  Add prototype for notify_std.
	* io/open.c (edit_modes): Allow status="old" and add extension to
	allow status="scratch"
	*io/list_read.c (nml_read_obj): Update call to notify_std.
	*io/io.h: Remove enum try and prototype for notify_std.
	*io/transfer.c (read_sf): Update call to notify_std.
	*io/format.c (parse_format_list): Update call to notify_std.

From-SVN: r115168
2006-07-04 01:36:31 +00:00
Francois-Xavier Coudert ee4ac5b0b4 io.h: Move proto for unit_to_fd...
* io/io.h: Move proto for unit_to_fd...
	* libgfortran.h: ...here.

From-SVN: r114983
2006-06-25 08:46:09 +00:00
John David Anglin 9b7e4f4ff8 re PR libgomp/27254 (FAIL: libgomp.fortran/reduction6.f90)
PR libgomp/27254
	* io/unit.c (get_internal_unit): Initialize and lock thread mutex
	for internal units.

From-SVN: r114765
2006-06-19 03:07:54 +00:00
Jerry DeLisle 22b2be06ec re PR libfortran/27757 (Problems with direct access io)
2006-05-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27757
	* io/unix.c (fd_seek): Set active to zero.

From-SVN: r114220
2006-05-29 23:39:53 +00:00
Jerry DeLisle a7a8dddd99 re PR fortran/27634 (formatted reading/writing: real format without dot)
2006-05-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27634
	* io/format.c (parse_format_list): Allow missing period in format only
	if -std=legacy.

From-SVN: r114212
2006-05-29 19:28:48 +00:00
Janne Blomqvist 59c0928b6a io.h (find_or_create_unit): Correct export declaration.
2006-05-27  Janne Blomqvist  <jb@gcc.gnu.org>

	* io/io.h (find_or_create_unit): Correct export declaration.

From-SVN: r114151
2006-05-27 11:36:49 +03:00
Jerry DeLisle 25292a1bf1 re PR libfortran/24459 ([4.1 Only] gfortran namelist problem)
2006-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/24459
	* io/list_read.c (nml_parse_qualifier): Leave loop spec end value
	at default value unless -std=f95 or if an array section
	is specified in namelist input.  Warn if -pedantic.
	* io/io.h (st_parameter_dt): Add expanded_read flag.

From-SVN: r113924
2006-05-20 07:14:50 +00:00
Jerry DeLisle 8bf6519618 re PR libfortran/22423 (Warnings when building libgfortran)
2006-05-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/22423
	* io/transfer.c (read_block): Return NULL instead of nothing.

From-SVN: r113923
2006-05-20 03:29:58 +00:00
Jerry DeLisle cacf2b9638 re PR libfortran/27575 (gfortran - does not generate error when trying to read too much data)
2006-05-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27575
	* io/transfer.c (read_block):  Add check for end file condition.
	(read_block_direct): Add check for end file condition.

From-SVN: r113837
2006-05-17 00:36:53 +00:00
Jerry DeLisle 4e72e1c5a2 re PR libfortran/27360 (Memory leaks when reading logicals)
2006-04-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27360
	
	* io/list_read.c (read_logical):  Free line_buffer and free saved.

From-SVN: r113388
2006-04-30 03:19:37 +00:00
Jerry DeLisle c4ee121ad5 re PR fortran/27304 (gfortran: Warn/abort when format in write does not fit passed arguments)
2006-04-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27304
	* io/transfer.c (formatted_transfer_scalar):  Generate error if data
	descriptors are exhausted.
	* io/format.c (next_format0): Fix comment.

From-SVN: r113363
2006-04-28 23:55:30 +00:00
Jerry DeLisle 54ffdb125c re PR libfortran/20257 (Fortran runtime error: End of record occurs when writing large arrays)
2006-04-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/20257
	* io/io.h: Add prototypes for get_internal_unit and free_internal_unit.
	* io/unit.c (get_internal_unit): Initialize unit number, not zero.
	(free_internal_unit): New function to consolidate freeing memory.
	(get_unit): Initialize internal_unit_desc to NULL when unit is
	external.
	* io/unix.c (mem_close): Check for not NULL before freeing memory.
	* io/transfer.c (read_block): Reset bytes_left and skip error if unit
	is preconnected and default record length is reached.
	(read_block_direct): Ditto.
	(write_block): Ditto.
	(write_buf): Ditto.
	(data_transfer_init): Only flush if not internal unit.
	(finalize_transfer): Ditto and delete code to free memory used by
	internal units.
	(st_read_done): Use new function - free_internal_unit.
	(st_write_done): Use new function - free_internal unit.

From-SVN: r113190
2006-04-23 02:04:58 +00:00
Jerry DeLisle 9855448d22 re PR fortran/27138 (gfortran: read(*,*) myInt advances only one character on error)
2006-04-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/27138
	* io/list_read.c (eat_line): New function.
	(parse_repeat): Use new function and free_saved.
	(read_logical): Same.
	(read_integer): Use new function.
	(parse_real): Use nml_bad_return and new function.
	(read_complex): Use new function and free_saved.
	(read_real): Same.

From-SVN: r112999
2006-04-17 02:33:51 +00:00
Jerry DeLisle 6f34d6e078 re PR fortran/26766 ([F2003] Recursive I/O still (again) broken)
2006-04-12  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26766
	* io/io.h: Add bit to identify associated unit as internal.
	* io/unit.c (get_external_unit): Renamed the find_unit_1 function to
	reflect the external unit functionality vs internal unit.
	(get_internal_unit): New function to allocate and initialize an internal
	unit structure.
	(get_unit): Use get_internal_unit and get_external_unit.
	(is_internal_unit): Revised to use new bit added in io.h.
	* io/transfer.c (data_transfer_init): Fix line width.
	(st_read_done): Free memory allocated for internal unit.
	(st_write_done): Add test to only flush and truncate when not an
	internal unit.  Free memory allocated for internal unit.

From-SVN: r112914
2006-04-13 06:24:58 +00:00
Jakub Jelinek ebf85e50c0 io.h (st_parameter_dt): Revert 2005-12-10 change to u.pad, fix comment.
* io/io.h (st_parameter_dt): Revert 2005-12-10 change to
	u.pad, fix comment.
	(check_st_parameter_dt): New compile time assert.

From-SVN: r112850
2006-04-11 09:15:00 +02:00
Jakub Jelinek 55fc9243b7 re PR libfortran/24685 (real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90))
PR libgfortran/24685
	* io/write.c (MIN_FIELD_WIDTH, STR, STR1): Define.
	(output_float): Increase buffer sizes for IEEE quad and IBM extended
	long double.
	(write_real): Output REAL(16) as 1PG43.34E4 rather than 1PG40.31E4.

From-SVN: r112819
2006-04-10 14:02:55 +02:00
Jerry DeLisle 967d4d456c re PR libfortran/26890 (SIZE parameter interacts with same variable in IO list character length specification.)
2006-04-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26890
	* io/io.h: Revert change to pad size made on 2006-03-30.
	Add comment explaining dependency with fortran/trans-io.c.

From-SVN: r112769
2006-04-07 23:05:12 +00:00
Jerry DeLisle 5eb90a1cbc write.c (output_float): Update condition to not error when decimal precision in format specifier is zero.
2006-04-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/write.c (output_float): Update condition to not error when
	decimal precision in format specifier is zero.

From-SVN: r112656
2006-04-04 02:50:23 +00:00
Jerry DeLisle d57d342432 re PR libfortran/26890 (SIZE parameter interacts with same variable in IO list character length specification.)
2006-03-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26890
	* io/io.h: Add size_used to st_parameter_dt, adjust pad size.
	*io/transfer.c (data_transfer_init): Initialize size_used to zero.
	(read_sf): Use size_used.
	(read_block): Likewise.
	(read_block_direct): Likewise.
	(write_block): Likewise.
	(write_buf): Likewise and eliminate erroneous FAILURE return.
	(finalize_transfer): Assign value of size_used to *dtp->size.

From-SVN: r112570
2006-03-31 05:11:03 +00:00
Jerry DeLisle ef6fa01d3a re PR libfortran/26880 (Can't read after non-advancing write with rewind)
2006-03-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26880
	* io/file_pos.c (st_rewind): Clear read_bad flag.

From-SVN: r112407
2006-03-27 05:59:37 +00:00
Jerry DeLisle 0853054e96 re PR libfortran/26661 (Sequential formatted read goes too far)
2006-03-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26661
	* io/io.h: Add read_sf so it can be used by read_x.
	* io/transfer.c (read_sf): Pass no_error flag to read_sf.  Use it to
	break out rather than error on EOF or EOR conditions.
	(read_block): Update call to read_sf.
	(read_block_direct): Ditto.
	* io/read.c (read_x): Use the modified read_sf instead of read_block.

From-SVN: r112390
2006-03-26 02:15:44 +00:00
Thomas Koenig 5068c62534 re PR libfortran/26735 ([4.1 only] -fconvert=swap and implied open)
2006-03-25  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/26735
	* io/transfer.c (data_transfer_init):  Set u_flags.convert
	on an unopened unit if specified by environment variable
	(via get_unformatted_convert) or by compile-time option.

2006-03-25  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/26735
	* gfortran.dg/convert_implied_open.f90:  New test case.

From-SVN: r112382
2006-03-25 21:31:48 +00:00
Thomas Koenig d67ab5eef8 [multiple changes]
2006-03-22  Thomas Koenig  <Thomas.Koenig@onlien.de>

	PR fortran/19303
	* gfortran.h (gfc_option_t):  Add record_marker.
	* lang.opt:  Add -frecord-marker=4 and -frecord-marker=8.
	* trans-decl.c:  Add gfor_fndecl_set_record_marker.
	(gfc_build_builtin_function_decls): Set
	gfor_fndecl_set_record_marker.
	(gfc_generate_function_code):  If we are in the main program
	and -frecord-marker was provided, call set_record_marker.
	* options.c (gfc_handle_option):  Add handling for
	-frecord-marker=4 and -frecord-marker=8.
	* invoke.texi:  Document -frecord-marker.

2006-03-22  Thomas Koenig  <Thomas.Koenig@onlien.de>

	PR fortran/19303
	* libgfortran.h (compile_options_t):  Add record_marker.
	* runtime/compile_options.c (set_record_marker):
	New function.
	* io/open.c:  If we have four-byte record markers, use
	GFC_INTEGER_4_HUGE as default record length.
	* io/file_pos.c (unformatted_backspace):  Handle
	different size record markers.
	* io/transfer.c (us_read):  Likewise.
	(us_write):  Likewise.
	(next_record_r):  Likewise.
	(write_us_marker):  Likewise.
	(next_record_w):  Likewise.

2006-03-22  Thomas Koenig  <Thomas.Koenig@online.de>

	PR fortran/19303
	* gfortran.dg/record_marker_1.f90:  New test case.
	* gfortran.dg/record_marker_2.f:  New test case.
	* gfortran.dg/record_marker_3.f90:  New test case.

From-SVN: r112290
2006-03-22 19:09:11 +00:00
Jerry DeLisle 54f9e2781e re PR fortran/26509 (incorrect behaviour of error-handler for direct access write)
2006-03-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26509
	* libgfortran.h: Add ERROR_DIRECT_EOR.
	* runtime/error.c (translate_error): Add translation for new error.
	* io/transfer.c (write_buf): Add check for EOR when mode is 
	direct access.

From-SVN: r112198
2006-03-18 01:56:07 +00:00