Commit Graph

401 Commits

Author SHA1 Message Date
Jerry DeLisle 7b063fdc13 re PR libfortran/36657 (Namelist reading bug with string constant immediately followed by comment)
2008-06-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/36657
	* io/list_read.c (read_character): Check for '!' along with separators.
	(find_nml_name): Likewise and eat the comment if found.

From-SVN: r137236
2008-06-28 21:46:53 +00:00
Jerry DeLisle fb669c2b42 re PR libfortran/36546 (Namelist error with tab following a comma and newline)
2008-06-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/36546
	* io/list_read.c (eat_separator): Add tab character to condition
	for looping past whitespace.

From-SVN: r136859
2008-06-17 04:14:07 +00:00
Jerry DeLisle a9608b5743 re PR fortran/36515 (Integer read from stdin yields a value overflow for a valid integer.)
2008-06-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/36515
	* libgfortran.h (compile_options_t): Add int range_check to structure.
	* runtime/compile_options.c (set_options): Add range_check option.
	(init_compile_options): Likewise.
	*io/read.c (read_decimal): Change overflow checks to include
	range_check.

From-SVN: r136822
2008-06-15 20:02:58 +00:00
Jerry DeLisle a82094b70d re PR libfortran/36538 (namelist failure with tabs preceding object name)
2008-06-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/36538
	* io/list_read.c (namelist_read): Add eat_separator to eliminate leading
	tabs.

From-SVN: r136776
2008-06-14 04:30:48 +00:00
Jerry DeLisle cea93abbe2 re PR libfortran/35863 ([F2003] Implement ENCODING="UTF-8")
2008-06-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35863
	* libgfortran.h: Change l8_to_l4_offset to big_endian and add endian_off.
	* runtime/main.c: Fix error in comment. Change l8_to_l4_offset to
	big_endian. (determine_endianness): Add endian_off and set its value
	according to big_endian.
	* gfortran.map: Add symbol for new _gfortran_transfer_character_wide.
	* io/io.h: Add prototype declarations for new functions.
	* io/list_read.c (list_formatted_read_scalar): Modify to handle kind=4.
	(list_formatted_read): Calculate stride based on kind for character type
	and use it when calling list_formatted_read_scalar.
	* io/inquire.c (inquire_via_unit): Change l8_to_l4_offset to big_endian.
	* io/open.c (st_open): Change l8_to_l4_offset to big_endian.
	* io/read.c (read_a_char4): New function to handle formatted read.
	* io/write.c: Define GFC_CHAR4(x) to improve readability of code.
	(write_a_char4): New function to handle formatted write.
	(write_character): Modify to accept the kind parameter and adjust for
	endianess of the machine. (list_formatted_write): Calculate the stride
	resulting from the kind and adjust the list_formatted_write_scalar call
	accordingly. (nml_write_obj): Adjust calls to write_character.
	(namelist_write): Likewise.
	* io/transfer.c (formatted_transfer_scaler): Rename 'len' argument to
	'kind' argument to better describe what it is. Add calls to new
	functions for kind == 4. (formatted_transfer): Modify to handle the case
	of type character and kind equals 4 to pass in the kind to the transfer
	routines. (transfer_character_wide): Add this new function.
	(transfer_array): Don't set kind to the character string length. Adjust
	strides bases on character kind.
	(unformatted_read): Adjust size based on kind for character types.
	(unformatted_write): Likewise. (data_transfer_init): Change
	l8_to_l4_offset to big_endian.

From-SVN: r136763
2008-06-13 20:28:08 +00:00
Jerry DeLisle 9355110f96 re PR fortran/36420 (Fortran 2008: g0 edit descriptor)
2008-06-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36420
	PR libfortran/36421
	PR libfortran/36422
	* io/io.h: Add prototype for write_real.
	* io/transfer.c (formatted_transfer_scalar): For FMT_G and width zero,
	use write_real.
	* io/format.c: Add zero width error message. (parse_format_list): Use
	error message for FMT_A if followed by FMT_ZERO. Use zero width error
	message	for FMT_G if mode is READ or if -std=f95 or f2003. (fmormat0):
	Fix typo in comment.
	* io/write.c (write_a): Set wlen to len if FMT_G and length is zero.
	(write_l): Add wlen variable and use it if FMT_G and width is zero.
	(write_decimal): If FMT_G, set m to -1 to flag processor dependent
	formatting. (write_real): Remove static declaration.

From-SVN: r136545
2008-06-07 23:59:53 +00:00
Thomas Koenig 51407486c4 list_read.c (list_formatted_read_scalar): Declare type as volatile to shut up compiler warning.
2008-05-17  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* io/list_read.c (list_formatted_read_scalar):  Declare
	type as volatile to shut up compiler warning.

From-SVN: r135480
2008-05-17 22:24:06 +00:00
Janne Blomqvist 8947fd62fa Part 1.1 of PR25561.
2008-05-15  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/25561
	* io/io.h (struct fbuf): Change pointer to position offset.
	* io/fbuf.c (fbuf_init): Reduce default size of buffer, ptr=>pos
	changes.
	(fbuf_reset): ptr=>pos changes.
	(fbuf_alloc): If the request doesn't fit, don't waste memory by
	keeping flushed bytes. ptr=>pos changes.
	(fbuf_flush): ptr=>pos changes.
	(fbuf_seek): Don't seek past the left tab limit, don't update active
	byte count.
	* io/open.c (new_unit): If RECL has been specified, used that as
	initial buffer size.

From-SVN: r135433
2008-05-16 20:42:44 +03:00
Janne Blomqvist 65686652e4 Fix fallout from part 1 of PR25561 patch.
2008-05-16  Janne Blomqvist  <jb@gcc.gnu.org>

        PR libfortran/35632
        * io/open.c (new_unit): Set stream position to correct value.

From-SVN: r135432
2008-05-16 20:37:30 +03:00
Janne Blomqvist 3044d36951 Part 1 of PR25561, fix compile warnings forgotten in actual commit.
From-SVN: r135379
2008-05-15 19:32:00 +03:00
Janne Blomqvist 7c1b4aba72 Add fbuf.c
From-SVN: r135376
2008-05-15 18:58:20 +03:00
Janne Blomqvist 15877a88eb Part 1 of PR 25561.
2008-05-15  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/25561
	* Makefile.am: Add fbuf.c to gfor_io_src.
	* Makefile.in: Regenerate.
	* io/io.h (read_block): Remove.
	(struct stream): Remove alloc_r_at function pointer.
	(salloc_r): Remove.
	(salloc_r_at): Remove.
	(salloc_w_at): Remove.
	(salloc_w): Remove offset argument.
	(struct fbuf): New struct for format buffer.
	(struct gfc_unit): Add fbuf.
	(read_block_form): New prototype.
	(fbuf_init): Likewise.
	(fbuf_destroy): Likewise.
	(fbuf_reset): Likewise.
	(fbuf_alloc): Likewise.
	(fbuf_flush): Likewise.
	(fbuf_seek): Likewise.
	* io/file_pos.c (formatted_backspace): Change to use sread.
	(unformatted_backspace): Likewise.
	(st_backspace): Flush format buffer.
	(st_rewind): Likewise.
	* io/list_read.c (next_char): Likewise.
	(nml_query): Tidying, flush format buffer.
	* io/open.c (new_unit): Init format buffer.
	* io/read.c (read_l): Change to use read_block_form.
	(read_a): Likewise.
	(read_decimal): Likewise.
	(read_radix): Likewise.
	(read_f): Likewise.
	(read_x): Empty reads also for stream I/O.
	* io/transfer.c (read_sf): Change to use sread.
	(read_block): Rename to read_block_form, change prototype, use sread.
	(read_block_direct): Don't seek stream files.
	(write_block): Change to use fbuf if external file, don't seek stream
	files.
	(write_buf): Don't seek stream files.
	(formatted_transfer_scalar): Use fbuf for external files.
	(us_read): Change to use sread.
	(pre_position): Do nothing for stream I/O.
	(data_transfer_init): Flush fbuf when switching from write to read, if
	POS is specified, seek stream file to correct offset.
	(skip_record): Change to use sread.
	(min_off): New function.
	(next_record_r): Change to use sread.
	(next_record_w): Change to use sset/sseek, flush fbuf.
	(finalize_transfer): Flush fbuf.
	* io/unit.c (init_units): Init fbuf for stdout, stderr.
	(close_unit_1): Destroy fbuf.
	(finish_last_advance_record): Flush fbuf, no need to seek.
	* io/unix.c (fd_alloc_r_at): Remove unused where argument.
	(fd_alloc_w_at): Likewise.
	(fd_read): Remove third argument to fd_alloc_r_at.
	(fd_write): Remove third argument to fd_alloc_w_at.
	(fd_sset): Likewise.
	(fd_open): Don't set alloc_r_at.
	(mem_alloc_r_at): Remove unused where argument.
	(mem_alloc_w_at): Likewise.
	(mem_read): Don't incorrectly return previous errno, remove unused
	third argument to alloc function.
	(mem_write): Likewise.
	(mem_set): Likewise.
	(open_internal): Don't set alloc_r_at pointer.
	* io/fbuf.c: New file.

From-SVN: r135373
2008-05-15 18:53:34 +03:00
Jerry DeLisle 36afed5a79 re PR libfortran/36202 ([mingw] Namelist read fails with CRLF)
2008-05-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36202
	* io/list_read (eat_separator): Handle the CR-LF case correctly.

From-SVN: r135177
2008-05-11 15:02:41 +00:00
Jerry DeLisle d0d51277e2 re PR libfortran/36131 (wrong IO)
2008-05-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36131
	* io/transfer.c (formatted_transfer_scalar): Revert patch for PR34974.
	(next_record_w): Likewise.

From-SVN: r134973
2008-05-06 04:00:38 +00:00
Jerry DeLisle c26cc9a6a6 re PR libfortran/36094 (Runtime error show_locus not working correctly)
2008-05-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/36094
	* runtime/error.c (show_locus): Provide modified error message when
	filename has not yet been associated with a unit number.
	* io/open.c (encoding_opt[]): Comment out "utf-8" option and add TODO.

From-SVN: r134876
2008-05-02 01:33:16 +00:00
Jakub Jelinek 24722ea98e list_read.c (snprintf): Define if HAVE_SNPRINTF isn't defined.
* io/list_read.c (snprintf): Define if HAVE_SNPRINTF isn't defined.
	(nml_read_obj): Add nml_err_msg_size argument.  Pass it down to
	recursive call.  Use snprintf instead of sprintf when %s nl->var_name
	is used.
	(nml_get_obj_data): Add nml_err_msg_size argument.  Pass it down to
	nml_read_obj call.  Use snprintf instead of sprintf when %s
	nl->var_name is used.  Pass nml_err_msg to nml_parse_qualifier instead
	of parse_err_msg array.  Append " for namelist variable " and
	nl->var_name to it.
	(namelist_read): Increase size of nml_err_msg array to 200.  Pass
	sizeof nml_err_msg as extra argument to nml_get_obj_data.

	* gfortran.dg/namelist_47.f90: New test.

From-SVN: r134132
2008-04-09 11:00:31 +02:00
Jerry DeLisle 931149a6b7 PR fortran/25829 28655
2008-04-07  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/25829 28655
	* io/open.c (edit_modes): Set flags.async. (new_unit) Set flags.async
	and flags.status. (st_open): Initialize flags.async.
	* io/list_read.c (read_charactor): Use delim_status instead of
	flags.delim.
	* io/read.c (read_x): Use pad_status instead of flags.pad.
	* io/inquire.c (inquire_via_unit): Add new checks.
	(inquire_via_filename): Likewise.
	* io/io.h (st_parameter_inquire): Add new flags.
	(st_parameter_dt): Likewise.
	* io/unit.c (get_internal_unit): Set flags.async. (init_units): Set
	flags.async.
	* io/transfer.c: Add delim and pad option arrays. (read_sf): Use
	pad_status instead of flags.pad. (read_block): Likewise.
	(data_transfer_init): Set flags.async and add checks.
	* io/write.c (write_character): Use delim_status.
	(list_formatted_write_scalar): Likewise. (nml_write_obj): Likewise.
	(namelist_write): Likewise.

From-SVN: r133988
2008-04-07 22:05:52 +00:00
Jerry DeLisle 10256cbe95 PR fortran/25829 28655
2008-04-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/25829 28655
	* gfortran.map: Add new symbol, _gfortran_st_wait.
	* libgfortran.h (st_paramter_common): Add new I/O parameters.
	* open.c (st_option decimal_opt[], st_option encoding_opt[],
	st_option round_opt[], st_option sign_opt[], st_option async_opt[]): New
	parameter option arrays. (edit_modes): Add checks for new parameters.
	(new_unit): Likewise. (st_open): Likewise.
	* list_read.c (CASE_SEPERATORS): Add ';' as a valid separator.
	(eat_separator): Handle deimal comma. (read_logical): Fix whitespace.
	(parse_real): Handle decimal comma. (read_real): Handle decimal comma.
	* read.c (read_a): Use decimal status flag to allow comma in place of a
	decimal point. (read_f): Allow comma as acceptable character in float.
	According to decimal flag, substitute a period for a comma.
	(read_x): If decimal status flag is comma, disable the read_comma flag,
	not allowing comma as a delimiter, an extension otherwise.
	* io.h: (unit_decimal, unit_encoding, unit_round, unit_sign,
	unit_async): New enumerators. Add all new I/O parameters.
	* unix.c (unix_stream, int_stream): Add io_mode	asychronous I/O	control.
	(move_pos_offset, fd_alloc_w_at): Fix some whitespace.
	(fd_sfree): Use new enumerator. (fd_read): Likewise.
	(fd_write): Likewise. (fd_close): Fix whitespace.
	(fd_open): Use new enumertors. (tempfile, regular_file,
	open_external): Fix whitespace. (output_stream, error_stream): Set
	method. (stream_offset): Fix whitespace.
	* transfer.c: (st_option decimal_opt[], sign_opt[], blank_opt[]): New
	option arrays. 	(formatted_transfer_scalar): Set sf_read_comma flag
	based on new decimal_status flag. (data_transfer_init): Initialize new
	parameters. Add checks for decimal, sign, and blank. (st_wait): New stub.
	* format.c: (format_lex): Add format specifiers DP, DC, and D.
	(parse_format_list): Parse the new specifiers.
	* write.c (write_decimal): Use new sign enumerators to set the sign.
	(write_complex): Handle decimal comma and semi-colon separator.
	(nml_write_obj): Likewise.
	* write_float.def: Revise sign enumerators. (calculate_sign): Use new
	sign enumerators. (output_float): Likewise. Use new decimal_status flag
	to set the decimal character to a point or a comma.

From-SVN: r133943
2008-04-05 22:18:03 +00:00
Jerry DeLisle fc8bc1753d re PR fortran/35699 (run-time abort writing zero sized section to direct access file)
2008-03-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35699
	* io/transfer.c (write_buf):  Don't pad the record, just return if the
	data is NULL.  (next_record_w): If there are bytes left in the record
	for unformatted direct I/O, pad out the record with zero bytes.

From-SVN: r133699
2008-03-28 22:13:17 +00:00
Jerry DeLisle 40e43495ce unix.c (fd_close): Do not close STDIN.
2008-03-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/unix.c (fd_close):  Do not close STDIN.

From-SVN: r133630
2008-03-27 05:30:18 +00:00
Jerry DeLisle 35077d5aed re PR fortran/35632 (stream io broken on FreeBSD due to ftruncate changes.)
2008-03-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35632
	* io/transfer.c (data_transfer_init):  Fix whitespace.
	(next_record_w): Truncate the file only if the stream
	position is short of the file end.

From-SVN: r133454
2008-03-22 22:03:13 +00:00
Jerry DeLisle 17f46ec355 re PR fortran/35627 (namelist read error)
2008-03-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35627
	* io/list_read.c (free_line): Clear the line buffer enable flag and
	reset the index into line_buffer, aka item_count.
	(next_char): Cleanup whitespace.
	(read_logical): Use unget_char to assure that the first character of the
	bad logical is saved in case it is part of an object name. Remove the
	clearing of index and flag that is now in free_line.
	(read_real): Likewise.

From-SVN: r133360
2008-03-20 02:05:05 +00:00
Jerry DeLisle 5a79ae8432 re PR fortran/35617 (read namelist error)
2008-03-17  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35617
	* io/list_read.c (eat_separator): If next character after eatline is '!'
	then eatline again.

From-SVN: r133302
2008-03-18 04:27:56 +00:00
Hans-Peter Nilsson 25abf44844 re PR libfortran/35293 (truncation errors with gfortran.dg/streamio_11.f90, 3, 4 and 15.)
PR libfortran/35293
	* io/unix.c (fd_truncate): Fold s->special_file case into
	success case of ftruncate/chsize call instead of the failure case.
	Make failure case actually return failure.  Properly update stream
	pointers on failure.  Call runtime_error for targets without
	neither ftruncate nor chsize where such a call would be needed.

From-SVN: r132888
2008-03-05 01:50:33 +00:00
Janne Blomqvist 4dabf73695 re PR libfortran/35063 (Clean up use of destroy_unit_mutex())
gcc:

2008-03-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR gcc/35063
	* gthr.h: Add __gthread_mutex_destroy as a function that must be
	implemented.
	* gthr-vxworks.h (__gthread_mutex_destroy): Null implementation.
	* gthr-single.h (__gthread_mutex_destroy): Likewise.
	* gthr-rtems.h (__gthread_mutex_destroy): Likewise.
	* gthr-mipssde.h (__gthread_mutex_destroy): Likewise.
	* gthr-nks.h (__gthread_mutex_destroy): Likewise.
	* gthr-solaris.h (__gthread_mutex_destroy): Call mutex_destroy.
	* gthr-win32.h (__GTHREAD_MUTEX_DESTROY_FUNCTION): Remove.
	(__gthread_mutex_destroy_function): Rename to
	__gthread_mutex_destroy.
	* gthr-dce.h (__gthread_mutex_destroy): Call
	pthread_mutex_destroy.
	* gthr-tpf.h (__gthread_mutex_destroy): Likewise.
	* gthr-posix.h (__gthread_mutex_destroy): Likewise.
	* gthr-posix95.h (__gthread_mutex_destroy): Likewise.


libgfortran:

2008-03-01  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/35063
	* io/unit.c (destroy_unit_mutex): Call __gthread_mutex_destroy
	instead of macro kludge.

From-SVN: r132800
2008-03-01 12:46:31 +02:00
Jerry DeLisle e32883d1a2 re PR libfortran/35132 (Formatted stream I/O write should truncate)
2008-02-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35132
	* io/transfer.c (next_record_w): Truncate after the last record for
	STREAM I/O.

	PR libfortran/34954
	* io/transfer.c (data_transfer_init): Initialize dtp->rec if writing.

	PR libfortran/34974
	* io/transfer.c (formatted_transfer_scalar): Flush the buffer if skips
	is less than zero. (next_record_w): Use sseek to position the file to
	the max position reached.

From-SVN: r132512
2008-02-21 02:27:07 +00:00
Jerry DeLisle 50a932e0cb re PR fortran/35036 (illegal E format descriptor produces wrong output)
2008-02-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35036
	* write_float.def (output_float):  Add error checks for zero digits
	after decimal point in E and D format specifiers.

From-SVN: r132510
2008-02-21 02:20:27 +00:00
Jerry DeLisle ef4195d63d [multiple changes]
2008-02-10  Danny Smith  <dannysmith@users.sourceforge.net>

	PR gcc/35063
	* gthr-win32.h (__gthread_mutex_destroy_function): New function
	to CloseHandle after unlocking to prevent accumulation of handle
	count. 

2008-02-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35063
	* io/unit.c (destroy_unit_mutex): New function that uses
	__gthread_mutex_destroy_function or pthread_mutex_destroy after
	unlocking and before free_mem for final closure of I/O unit.
	(delete_root): Use new function.
	(free_internal_unit): Likewise.
	(close_unit_1): Likewise.

From-SVN: r132217
2008-02-10 18:06:34 +00:00
Thomas Koenig 6cac36304e re PR libfortran/34887 (reverse tabbing before slash descriptor (regression vs. g77))
2008-01-26  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfofortran/34887
	* io/transfer.c (next_record_w): Always move to the farthest
	position when completing the record (also when we are
	processing a slash edit descriptor).

2008-01-26  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfofortran/34887
	* gfortran.dg/x_slash_2.f:  New test.

From-SVN: r131864
2008-01-26 15:22:59 +00:00
Jerry DeLisle 4152bc263e re PR fortran/34876 (Can't read/write array sections with negative stride not specified)
2008-01-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/34876
	* io/transfer.c (write_buf): Handle case of zero sized array.
	(transfer_array): Set data pointer to NULL and size to zero.  Then
	make a data transfer and return.

From-SVN: r131848
2008-01-25 23:34:53 +00:00
Jerry DeLisle 17c2c96cdc inquire.c (inquire_via_unit): If a unit is opened...
2008-01-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/inquire.c (inquire_via_unit): If a unit is opened, return values
	according to the open action for DIRECT, FORMATTED, and	UNFORMATTED.
	(inquire_via_filename): Return "UNKNOWN" for SEQUENTIAL, DIRECT,
	FORAMATTED, and UNFORMATTED inquiries.
	* io/unix.c (inquire_sequential): Return "UNKNOWN" when appropriate
	for files that are not opened. (inquire_direct): Same.
	(inquire_formatted): Same.

From-SVN: r131672
2008-01-20 06:33:49 +00:00
Jerry DeLisle 6c540522ba transfer.c (formatted_transfer_scalar): Set max_pos to the greater of the current max_pos or the newly calculated position.
2008-01-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/transfer.c (formatted_transfer_scalar): Set max_pos to the greater
	of the current max_pos or the newly calculated position.

From-SVN: r131640
2008-01-18 22:19:15 +00:00
Tobias Burnus 810143349d write.c (write_real): Increase default precision for
2008-01-18  Tobias Burnus  <burnus@net-b.de>

        * io/write.c (write_real): Increase default precision for
        * REAL(16) by one.

2008-01-18  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/large_real_kind_form_io_1.f90: Enlarge string for
        * internal I/O.

From-SVN: r131639
2008-01-18 22:43:08 +01:00
Jerry DeLisle fa347f2232 re PR fortran/34676 (IO error delayed)
2008-01-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/34676
	* io/list_read.c (next_char): Only save the EOF condition for later if
	advance="no".

From-SVN: r131337
2008-01-05 16:00:40 +00:00
Thomas Koenig 9370b3c0f9 re PR fortran/34565 (internal write to string array fails)
2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34565
	* io/io.h:  Adjust protoypes for open_internal(),
	next_array_record() and init_loop_spec().
	* io/list_read.c (next_char):  Use argument "finished"
	of next_array_record to check for end on internal file.
	* io/unit.c:  Calculate the offset for an array
	internal file and supply this informatin to open_internal().
	* io/unix.c (open_internal):  Set the offset for the internal
	file on open.
	* io/transfer.c (init_loop_spec):  Calculate the starting
	record in case of negative strides.  Return size of 0 for
	an empty array.
	(next_array_record):  Use an extra flag to signal that the
	array is finished.
	(next_record_r):  Use the new flag to next_array_record().
	(next_record_w):  Likewise.

2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34565
	* gfortran.dg/internal_readwrite_1.f90:  New test.
	* gfortran.dg/internal_readwrite_2.f90:  New test.

From-SVN: r131305
2008-01-03 19:49:38 +00:00
Jerry DeLisle f15db427e1 transfer.c (read_sf): Check if readlen was less than the requested number of bytes to read and if so...
2007-12-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/transfer.c (read_sf): Check if readlen was less than the requested
	number of bytes to read and if so, generate error.

From-SVN: r131177
2007-12-26 03:37:01 +00:00
Tobias Burnus 667e20459d re PR libfortran/34530 (namelist read broken when whitespace after &namelist)
2007-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34530
        * io/list_read.c (eat_line): Move up in the file.
        (eat_separator): In namelist mode, skip over comment lines.

2007-12-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34530
        * gfortran.dg/namelist_44.f90: New.

From-SVN: r131099
2007-12-20 09:16:48 +01:00
Jerry DeLisle 78a15b1f3f re PR libfortran/34427 (Revision 130708 breaks namelist input)
2007-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/34427
	* io/list_read.c (read_real): Handle intervening line ends and spaces.
	(get_name): Don't push separators to saved_string.
	(eat_separator): If in namelist mode eat spaces and line ends as well.

From-SVN: r131003
2007-12-17 00:47:14 +00:00
Thomas Koenig 108bc19009 re PR libfortran/34370 (file positioning after nonadvancing i/o)
2007-12-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34370
	PR libfortran/34323
	PR libfortran/34405
	* io/io.h:  Add previous_nonadvancing_write to gfc_unit.
	Add prototype for finish_last_advance_record.
	* io/file_pos.c (st_backspace):  Generate error if backspace is
	attempted for direct access or unformatted stream.
	If there are bytes left from a previous ADVANCE="no", write
	them out before performing the backspace.
	(st_endfile):  Generate error if endfile is attempted for
	direct access.
	If there are bytes left from a previous ADVANCE="no", write
	them out before performing the endfile.
	(st_rewind):  Generate error if rewind is attempted for
	direct access.
	* unit.c (close_unit_1):  Move functionality to write
	previously written bytes to...
	(finish_last_advance_record):  ... here.
	* transfer.c (data_transfer_init):  If reading, reset
	previous_nonadvancing_write.
	(finalize_transfer):  Set the previous_noadvancing_write
	flag if we are writing and ADVANCE="no" was specified.
	Only call next_record() if advance="no" wasn't specified.

2007-12-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/34370
	PR libfortran/34323
	PR libfortran/34405
	* gfortran.dg/advance_6.f90:  New test case.
	* gfortran.dg/direct_io_7.f90:  New test case.
	* gfortran.dg/streamio_13.f90:  New test case.

From-SVN: r130912
2007-12-13 19:35:09 +00:00
Tobias Burnus b446725a8a re PR libfortran/34427 (Revision 130708 breaks namelist input)
2007-12-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34427
        * io/list_read.c (read_real): Fix unwinding for namelists.

2007-12-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34427
        * gfortran.dg/namelist_42.f90: New.

From-SVN: r130889
2007-12-13 12:01:00 +01:00
Jerry DeLisle 5f026f90f0 re PR fortran/34411 (hang-up during read of non-expected input)
2007-12-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/34411
	* io/read.c (convert_real, read_l, read_decimal, read_radix, read_f):
	Call next_record after bad read or overflow error.

From-SVN: r130767
2007-12-11 03:49:52 +00:00
Tobias Burnus de80e4f820 [multiple changes]
2007-12-09  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34404
        * io/list_read.c (parse_real): Remove superfluous "goto bad;".

2007-12-09  H.J. Lu  <hjl@lucon.org>
             Tobias Burnus  <burnus@net-b.de>

        PR fortran/34404
        * gfortran.dg/read_2.f90: New.

From-SVN: r130723
2007-12-09 13:58:25 +01:00
Tobias Burnus c9f7e8258a re PR fortran/34319 (I/O: Support "NaN", "Infinity" and "INF" as input)
2007-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34319
        * io/list_read.c (parse_real, read_real): Support NaN/Infinity.

2007-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34319
        * gfortran.dg/nan_3.f90: New.

From-SVN: r130708
2007-12-08 16:51:52 +01:00
Jerry DeLisle 2ea7440786 re PR libfortran/33985 (access="stream",form="unformatted" doesn't buffer)
2007-12-02  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/33985
	* io/transfer.c (read_block, read_block_direct, write_block, write_buf):
	Don't seek if file position is already there for STREAM I/O.
	(finalize_transfer): For STREAM I/O don't flush unless the file position
	has moved past the start position before the transfer.

Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>

From-SVN: r130574
2007-12-02 23:17:16 +00:00
Jerry DeLisle 3c55599b1f re PR libfortran/34291 (Segfault in io/list_read.c handling of end conditions)
2007-11-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/34291
	* io/list_read.c (read_character): When reading an unquoted string,
	return if special characters that could signify the end of the namelist
	read are encountered.

From-SVN: r130548
2007-11-30 23:19:34 +00:00
Jerry DeLisle 31de5c748d re PR libfortran/33985 (access="stream",form="unformatted" doesn't buffer)
2007-11-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33985
	* io/transfer.c (finalize_transfer): Revert previous patch.

From-SVN: r129955
2007-11-07 02:43:44 +00:00
Jerry DeLisle 0c70ecbea2 re PR libfortran/33985 (access="stream",form="unformatted" doesn't buffer)
2007-11-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33985
	* io/transfer.c (finalize_transfer): Do not flush for
	unformatted STREAM I/O.

From-SVN: r129870
2007-11-03 14:57:13 +00:00
Francois-Xavier Coudert 1f94e1d88e re PR fortran/33795 (Environment variable GFORTRAN_UNBUFFERED_<number> not working)
2007-10-18  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33795
	* libgfortran.h: Add unbuffered_preconnected.
	* io/unix.c (output_stream): Set stream unbuffered flag if
	options.unbuffered_preconnected has been set.
	(error_stream): Ditto.
	* runtime/environ.c (variable_table): Add to environment variable table
	the entry: GFORTRAN_UNBUFFERED_PRECONNECTED. 

Co-Authored-By: Jerry DeLisle <jvdelisle@gcc.gnu.org>

From-SVN: r129470
2007-10-19 04:10:58 +00:00
Jerry DeLisle 6ae786d29d re PR libfortran/33055 (Runtime error in INQUIRE unit existance with -fdefault-integer-8)
2007-10-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33055
	* io/inquire.c (inquire_via_unit):  If inquiring by unit, check for
	an error condition from the IOSTAT variable and set EXIST to false if
	there was a bad unit number.

From-SVN: r129344
2007-10-15 13:59:02 +00:00
Jerry DeLisle 45dfbe77d2 re PR libfortran/33672 (Additional runtime checks needed for namelist reads)
2007-10-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33672
	* io/list_read.c (nml_parse_qualifier): Add character specific error
	messages.  Check for proper form of sub-string qualifiers.  Return the
	parsed_rank flag indicating a non-zero rank qualifier.
	(nml_get_obj_data):  Count the instances of non-zero rank qualifiers.
	Issue an error if more that one non-zero rank qualifier is found.

From-SVN: r129309
2007-10-15 01:33:16 +00:00