Commit Graph

678 Commits

Author SHA1 Message Date
Jerry DeLisle dbb400d707 re PR fortran/61632 (Improve error locus on large format strings)
2014-07-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/61632
	* io/format.c (format_error): Avoid invalid string pointer by
	using the fortran string length values to generate error string.
	(parse_format): Allocate the null terminator for the format
	string.

From-SVN: r212875
2014-07-20 20:03:41 +00:00
Jerry DeLisle 9389649842 re PR libfortran/61640 (KIND=4 Character Array Internal Unit Read Fail)
2014-06-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/61640
	* io/list_read.c (next_char_internal): Adjust the read length to
	a single wide character. (eat_spaces): Add missing paren. 
	* io/unix.c (mem_read4): Use the correct mem_alloc function for
	wide character internal reads.

From-SVN: r212118
2014-06-29 02:49:45 +00:00
Jerry DeLisle b896e6744e re PR libfortran/61499 (Internal read of negative integer broken)
2014-06-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/61499
	* io/list_read.c (eat_spaces): Use a 'for' loop instead of
	'while' loop to skip the loop if there are no bytes left in the
	string. Only seek if actual spaces can be skipped.

From-SVN: r212059
2014-06-27 04:23:36 +00:00
Janne Blomqvist 92e6f3a43e Introduce xmallocarray, an overflow checking variant of xmalloc.
2014-06-17  Janne Blomqvist  <jb@gcc.gnu.org>

	* libgfortran.h (xmallocarray): New prototype.
	* runtime/memory.c (xmallocarray): New function.
	(xcalloc): Check for nonzero separately instead of multiplying.
	* generated/*.c: Regenerated.
	* intrinsics/cshift0.c (cshift0): Call xmallocarray instead of
	xmalloc.
	* intrinsics/eoshift0.c (eoshift0): Likewise.
	* intrinsics/eoshift2.c (eoshift2): Likewise.
	* intrinsics/pack_generic.c (pack_internal): Likewise.
	(pack_s_internal): Likewise.
	* intrinsics/reshape_generic.c (reshape_internal): Likewise.
	* intrinsics/spread_generic.c (spread_internal): Likewise.
	(spread_internal_scalar): Likewise.
	* intrinsics/string_intrinsics_inc.c (string_trim): Likewise.
	(string_minmax): Likewise.
	* intrinsics/transpose_generic.c (transpose_internal): Likewise.
	* intrinsics/unpack_generic.c (unpack_internal): Likewise.
	* io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value.
	* io/transfer.c (st_set_nml_var): Call xmallocarray instead of
	xmalloc.
	* io/unit.c (get_internal_unit): Likewise.
	(filename_from_unit): Don't cast xmalloc return value.
	* io/write.c (nml_write_obj): Likewise, formatting.
	* m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray
	instead of xmalloc.
	(besse_yn_r'rtype_kind`): Likewise.
	* m4/cshift1.m4 (cshift1): Likewise.
	* m4/eoshift1.m4 (eoshift1): Likewise.
	* m4/eoshift3.m4 (eoshift3): Likewise.
	* m4/iforeach.m4: Likewise.
	* m4/ifunction.m4: Likewise.
	* m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code):
	Likewise.
	* m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise.
	* m4/matmul.m4 (matmul_'rtype_code`): Likewise.
	* m4/matmull.m4 (matmul_'rtype_code`): Likewise.
	* m4/pack.m4 (pack_'rtype_code`): Likewise.
	* m4/reshape.m4 (reshape_'rtype_ccode`): Likewise.
	* m4/shape.m4 (shape_'rtype_kind`): Likewise.
	* m4/spread.m4 (spread_'rtype_code`): Likewise.
	(spread_scalar_'rtype_code`): Likewise.
	* m4/transpose.m4 (transpose_'rtype_code`): Likewise.
	* m4/unpack.m4 (unpack0_'rtype_code`): Likewise.
	(unpack1_'rtype_code`): Likewise.
	* runtime/convert_char.c (convert_char1_to_char4): Likewise.
	(convert_char4_to_char1): Simplify.
	* runtime/environ.c (init_unformatted): Call xmallocarray instead
	of xmalloc.
	* runtime/in_pack_generic.c (internal_pack): Likewise.

From-SVN: r211721
2014-06-17 06:50:34 +03:00
Janne Blomqvist 89a862b40a PR 56981 Flush buffer at record boundary if possible.
2014-06-08  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/56981
	* io/unix.h (struct stream_vtable): Add new member function,
	markeor.
	(smarkeor): New inline function.
	(flush_if_unbuffered): Remove prototype.
	* io/unix.c (raw_markeor): New function.
	(raw_vtable): Initialize markeor member.
	(buf_markeor): New function.
	(buf_vtable): Initialize markeor member.
	(mem_vtable): Likewise.
	(mem4_vtable): Likewise.
	(flush_if_unbuffered): Remove function.
	* io/transfer.c (next_record): Call smarkeor instead of
	flush_if_unbuffered.

From-SVN: r211353
2014-06-08 08:43:29 +03:00
Janne Blomqvist d74fd3c72b Introduce xrealloc, use it.
2014-05-26  Janne Blomqvist  <jb@gcc.gnu.org>

	* libgfortran.h (xrealloc): New prototype.
	* runtime/memory.c (xrealloc): New function.
	* io/fbuf.c (fbuf_alloc): Use xrealloc.
	* io/list_read.c (push_char_default): Likewise.
	(push_char4): Likewise.

From-SVN: r210948
2014-05-26 23:56:45 +03:00
Jerry DeLisle 3b111bd757 [multiple changes]
2014-05-26  Tobias Burnus  <burnus@net-b.de>

	PR fortran/55117
	* trans-io.c (nml_full_name, transfer_namelist_element): Insert
	a '+' rather then '%' to differentiate namelist variable names
	that are based on extended derived types.

2014-05-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/55117
	* io/list_read.c (extended_look_ahead): New helper function to
	scan the namelist name and look for matches with the new '+'
	extended type parent indicator.  (str_comp_extended): New
	helper function to compare the namelist name with the varname
	namelist. (find_nml_name): Use the new helper functions to match
	the extended type varnames.

From-SVN: r210934
2014-05-26 15:19:36 +00:00
Jerry DeLisle 03c0f19520 re PR libfortran/61173 (Erroneous "end of file" with internal read)
2014-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/61173
	* io/list_read.c (eat_spaces): If the next character pointed to
	is a space, don't seek, must be at the end.

From-SVN: r210898
2014-05-24 19:26:02 +00:00
Janne Blomqvist 4269f19c09 PR 60324 Handle long path names, don't use PATH_MAX.
From-SVN: r210738
2014-05-22 06:51:25 +03:00
Jerry DeLisle d428be77b6 re PR libfortran/52539 (I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write)
2014-05-17  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/52539
	* io/io.h (gfc_unit): New function pointers *next_char_fn_ptr
	and *push_char_fn_ptr.
	*io/list_read.c (next_char): Create macro with this name to call
	the new function pointer. Split the original next_char function
	into three new functions. (next_char_default, next_char_internal,
	next_char_utf8): New functions. (push_char): Create macro with
	this name to call new function pointer. Split the original
	push_char into three new functions. (push_char_default,
	push_char_internal, push_char4): New functions. (set_workers):
	New function to initilize the function pointers depending on the
	type of IO to be performed. (list_formatted_read_scalar): Use
	set_workers function. (finish_list_read): Likewise.
	(namelist_read): Likewise.
	(nml_get_obj_data): Use push_char_default.

From-SVN: r210574
2014-05-18 02:29:27 +00:00
Janne Blomqvist 870c7fa03a PR 61187 Fix use of uninitialized memory.
2014-05-16  Janne Blomqvist  <jb@gcc.gnu.org>

	PR libfortran/61187
	* io/unix.c (raw_close): Check if s->fd is -1.
	(fd_to_stream): Check return value of fstat(), handle error.

From-SVN: r210527
2014-05-16 23:37:13 +03:00
Jerry DeLisle 0222756393 re PR libfortran/61049 (NIST test FM906 fails)
2014-05-06  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/61049
	* io/list_read.c (list_formatted_read_scalar): Use eat_separator
	and delete extraneous code.

From-SVN: r210134
2014-05-07 01:31:42 +00:00
Jerry DeLisle 42c1e008b0 re PR libfortran/52539 (I/O: Wrong result for UTF-8/UCS-4 list-directed and namelist read and nml write)
2014-04-26  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/52539
	* io/list_read.c: Add uchar typedef. (push_char4): New function
	to save kind=4 character. (next_char_utf8): New function to read
	a single UTF-8 encoded character value. (read_chracter): Update
	to use the new functions for reading UTF-8 strings.
	(list_formatted_read_scalar): Update to handle list directed
	reads of UTF-8 strings. (nml_read_obj): Likewise update for
	UTF-8 strings in namelists.
	* io/write.c (nml_write_obj): Add kind=4 character support for
	namelist writes.

From-SVN: r209828
2014-04-26 21:52:26 +00:00
Jerry DeLisle 861b2d2cde re PR fortran/60810 (list directed io from array results in end of file)
2014-04-11  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/60810
	io/unit.c (is_trim_ok): If internal unit is array, do not trim.

From-SVN: r209329
2014-04-12 00:04:41 +00:00
Jerry DeLisle 09e40ffe10 re PR fortran/60148 (strings in NAMELIST do not honor DELIM= in open statement)
2014-03-21  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/60148
	* io/transfer.c (data_transfer_init): If std= was specified, set
	delim status to DELIM_NONE of no other was specified.

From-SVN: r208759
2014-03-21 22:19:44 +00:00
Ulrich Weigand b5b5834350 configure.ac: Check for presence of fcntl.
* configure.ac: Check for presence of fcntl.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* io/unix.c (set_close_on_exec): Check for HAVE_FCNTL.

From-SVN: r208634
2014-03-18 09:58:17 +00:00
Jerry DeLisle e34994fcff re PR libfortran/46800 (Handle CTRL-D correctly with STDIN)
2014-03-17  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/46800
	* io/list_read.c (list_formatted_read_scalar): Do not use
	eat_separator. Explicitly set the comma and end-of-line flags.
	Check for END condition from finish_separator.

From-SVN: r208629
2014-03-18 01:20:02 +00:00
Jerry DeLisle e94710443a re PR fortran/58324 (Bogus END-of-line error with list-directed I/O of file without trailing sequential record marker)
2014-03-15  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/58324
	* io/list_read.c (finish_list_read): Read one character to check
	for the end of the file.  If it is the end, then issue the file
	end error message.  If not, use eat_line to reach the end
	without giving error.  The next attempt to read will then
	issue the error as described above.

From-SVN: r208591
2014-03-15 15:12:01 +00:00
Jerry DeLisle 3b63b663d7 re PR libfortran/38199 (missed optimization: I/O performance)
2014-03-12  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/38199
	* io/read.c (read_decimal): Quickly skip spaces to avoid calls
	to next_char.
	* io/unit.c (is_trim_ok): New helper function to check various
	conditions to see if its OK to trim the internal unit string.
	(get_internal_unit): Use LEN_TRIM to shorten selected internal
	unit strings for optimizing READ. Enable this optimization for
	formatted READ.
	* io/list_read.c (finish_list_read): Don't call eat_line for
	internal units.

From-SVN: r208528
2014-03-13 05:06:57 +00:00
Jerry DeLisle c8869272f7 re PR libfortran/38199 (missed optimization: I/O performance)
2014-03-08  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/38199
	* io/list_read.c (next_char): Delete unuseful error checks.
	(eat_spaces): For character array reading, skip ahead over
	spaces rather than call next_char multiple times.

From-SVN: r208438
2014-03-09 03:17:16 +00:00
Dominique d'Humieres 4e185d7cee re PR fortran/60128 (Wrong ouput using en edit descriptor)
2014-03-08  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR libgfortran/60128
	* io/write_float.def (output_float): Remove unused variable
	nzero_real. Replace a double space with a single one.
	(determine_en_precision): Fix wrong handling of the EN format.

	PR libfortran/60128
	* gfortran.dg/fmt_en.f90: New test.

From-SVN: r208423
2014-03-08 06:04:34 +00:00
Jerry DeLisle 75b2dba9ae re PR fortran/60148 (strings in NAMELIST do not honor DELIM= in open statement)
2014-03-03  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/60148
	* io/inquire.c (inquire_via_unit): In the case of
	DELIM_UNSPECIFIED set inquire return string to "NONE".
	* io/list_read.c (read_character): In the case of DELIM_NONE and
	namelists, complete the character read using the namelist
	variable length.
	* io/open.c (new_unit): Don't set delim status to none if not
	specified so that DELIM_UNSPECIFIED can be used later.
	* io/transfer.c (data_transfer_init): For namelist I/O, if the
	unit delim status is unspecified set the current status to quote.
	Otherwise, set current status to the unit status.
	* io/unit.c (get_internel_unit, init_unit): Remember to set
	flags_delim initially to DELIM_UNSPECIFIED so defaults come out
	correctly.
	* io/write.c (write_character): Add a new function argument
	"mode" to signify that raw output is to be used vs output with
	delimiters. If the mode is set to DELIM (1) proceed with
	delimiters. (list_formatted_write_scalar): Write the separator
	only if a delimiter was previously specified. Update the call to
	write_character with the mode argument given.
	(namelist_write_newline): Use the mode argument. (nml_write_obj):
	Use the mode argument. Remove use of tmp_delim. Write the
	semi-colon or comma correctly only when needed with using
	delimiters. Cleanup whitespace.
	(namelist_write): If delim is not specified in namelist I/O,
	default	to using quotes. Get rid of the tmp_delim variable and
	use the new mode argument in write_character.

From-SVN: r208302
2014-03-04 04:33:40 +00:00
Tobias Burnus 76a4b7ad2d re PR fortran/60286 (INQUIRE reports STDOUT as not writable)
2014-02-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/60286
        * libgfortran/io/inquire.c (yes, no): New static const char
        * vars.
        (inquire_via_unit): Use them. Use OPEN mode instead of using
        POSIX's access to query about write=, read= and readwrite=.

2014-02-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/60286
        * gfortran.dg/inquire_16.f90: New.

From-SVN: r207979
2014-02-21 08:37:06 +01:00
Jerry DeLisle 91d45414d8 write_float.def (output_float): Remove inadvertent test code from previous patch.
2014-01-20  Jerry DeLisle  <jvdelisle@gcc.gnu>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>

	* io/write_float.def (output_float): Remove inadvertent test
	code from previous patch.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>

From-SVN: r206865
2014-01-21 02:39:53 +00:00
Jerry DeLisle 32aeb94ab1 re PR libfortran/59771 (Cleanup handling of Gw.0 and Gw.0Ee format)
2014-01-19  Jerry DeLisle  <jvdelisle@gcc.gnu>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR libfortran/59771
	PR libfortran/59774
	PR libfortran/59836
	* io/write_float.def (output_float): Fix wrong handling of the
	Fw.0 format.
	(output_float_FMT_G_): Fixes rounding issues with -m32.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>

From-SVN: r206785
2014-01-19 23:17:43 +00:00
Jerry DeLisle 2558e2e838 re PR fortran/59700 (Misleading/buggy runtime error message: Bad integer for item 0 in list input)
2014-01-11  Jerry DeLisle  <jvdelisle@gcc.gnu>
	    Dominique d'Humieres  <dominiq@lps.ens.fr>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR libfortran/59700
	PR libfortran/59764
	* io/io.h (struct st_parameter_dt): Assign expanded_read flag to
	unused bit. Define new variable line_buffer_pos.
	* io/list_read.c (free_saved, next_char, l_push_char,
	read_logical, read_real): Replace use of item_count with
	line_buffer_pos for line_buffer look ahead.
	(read_logical, read_integer, parse_real, read_real, check_type):
	Adjust location of free_line to after generating error messages
	to retain the correct item count for the message.

Co-Authored-By: Dominique d'Humieres <dominiq@lps.ens.fr>
Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r206553
2014-01-11 18:57:20 +00:00
Richard Sandiford f0bcf62899 Update copyright years in libgfortran/
From-SVN: r206296
2014-01-02 22:25:45 +00:00
Steven G. Kargl 7b6b435332 read.c (read_f): Convert assert to runtime error.
2013-12-18  Steven G. Kargl  <kargl@gcc.gnu.org>

	* io/read.c (read_f): Convert assert to runtime error.

2013-12-18  Steven G. Kargl  <kargl@gcc.gnu.org>

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

From-SVN: r206102
2013-12-18 23:41:50 +00:00
Andreas Tobler 95796c1fa5 unix.c (tempfile_open): Only use the needed flag O_CLOEXEC.
2013-12-17  Andreas Tobler  <andreast@gcc.gnu.org>

    * io/unix.c (tempfile_open): Only use the needed flag O_CLOEXEC.

From-SVN: r206064
2013-12-17 19:12:39 +01:00
Jerry DeLisle 1ede59e4c7 re PR libfortran/59419 (Failing OPEN with FILE='xxx' and IOSTAT creates the file 'xxx' after revision 196783)
2013-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu>

	PR libfortran/59419
	* io/file_pos.c (st_rewind): Do proper return after
	generate_error.
	* io/open.c (edit_modes): Move action code inside block that
	checks for library ok. (new_unit): Do cleanup after error.
	(st_open): Do proper return after error.
	* io/transfer.c (data_transfer_init): Likewise.

From-SVN: r206039
2013-12-17 03:06:04 +00:00
Janne Blomqvist 35f48a901d When file status is unknown, don't set O_CREAT when opening read-only.
2013-11-15  Janne Blomqvist  <jb@gcc.gnu.org>
	    Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/59108
	* io/unix.c (regular_file): Don't set O_CREAT when opening a file
	read-only with unknown status. Mask out O_CREAT when falling back
	to opening read-only if ACTION= is not set and read-write fails.

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

From-SVN: r204864
2013-11-16 00:00:36 +02:00
Janne Blomqvist c20fdb917f Set close-on-exec flag when opening files.
2013-11-10  Janne Blomqvist  <jb@gcc.gnu.org>

	* configure.ac: Check presence of mkostemp.
	* io/unix.c (set_close_on_exec): New function.
	(tempfile_open): Use mkostemp and O_CLOEXEC if available, fallback
	to calling set_close_on_exec.
	(regular_file): Add O_CLOEXEC to flags if defined.
	(open_external): Call set_close_on_exec if O_CLOEXEC is not
	defined.
	* config.h.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* aclocal.m4: Regenerated.

From-SVN: r204654
2013-11-10 22:34:29 +02:00
Tobias Burnus 7902928918 re PR fortran/55469 (memory leak on read with istat.ne.0)
2013-10-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/55469
        * io/list_read (parse_repeat, read_integer, read_character,
        parse_real, read_real, check_type, list_formatted_read_scalar,
        finish_list_read): Call list_free.

From-SVN: r203086
2013-10-01 22:52:49 +02:00
Ondřej Bílka 9b110be230 trans-decl.c: Fix comment typos.
2013-07-21   Ondřej Bílka  <neleai@seznam.cz>

        * trans-decl.c: Fix comment typos.
        * trans-expr.c: Ditto.

2013-07-21   Ondřej Bílka  <neleai@seznam.cz>

        * io/transfer.c: Fix comment typos.

From-SVN: r201107
2013-07-21 19:57:23 +02:00
Tobias Burnus 82a4f54cc5 re PR libfortran/35862 ([F2003] Implement new rounding modes for run time)
2013-07-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/35862
        * libgfortran.h (GFC_FPE_DOWNWARD, GFC_FPE_TONEAREST,
        GFC_FPE_TOWARDZERO, GFC_FPE_UPWARD): New defines.

2013-07-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/35862
        * libgfortran.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): New prototypes.
        * config/fpu-387.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): New functions.
        * config/fpu-aix.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): Ditto.
        * config/fpu-generic.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): Ditto.
        * config/fpu-glibc.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): Ditto.
        * config/fpu-sysv.h (set_fpu_rounding_mode,
        get_fpu_rounding_mode): Ditto.
        * configure.ac: Check for fp_rnd and fp_rnd_t.
        * io/io.h (enum unit_round): Use GFC_FPE_* for the value.
        * io/read.c (convert_real): Set FP ronding mode.
        * Makefile.in: Regenerate.
        * aclocal.m4: Regenerate.
        * config.h.in: Regenerate.
        * configure: Regenerate.

2013-07-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/35862
        * gfortran.dg/round_4.f90: New.


Co-Authored-By: Uros Bizjak <ubizjak@gmail.com>

From-SVN: r201093
2013-07-21 13:54:27 +02:00
Tobias Burnus 937424c182 re PR fortran/57633 (I/O: Problem with formatted read: reading CR-LF files (\r\n))
2013-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57633
        * io/list_read.c (next_char, eat_separator): Don't set EOL for \r.

2013-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57633
        * gfortran.dg/list_read_11.f90: New.

From-SVN: r200238
2013-06-20 12:55:03 +02:00
Tobias Burnus c2b2130c71 re PR libfortran/57496 (I/O: WRITE(*,*) HUGE(0._10) gives SIGFPE with -ffpe-trap=overflow)
2013-06-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57496
        * io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L,
        * ISFINITE,
        SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2,
        ISNAN2L, ISNAN): New macros.
        (output_float_FMT_G_,WRITE_FLOAT): Use them.

From-SVN: r199598
2013-06-03 11:20:46 +02:00
David Edelsohn 19f0e98f58 environ.c: Include unistd.h.
* runtime/environ.c: Include unistd.h.
        * runtime/pause.c: Test HAVE_UNISTD_H.
        * runtime/stop.c: Same.
        * io/open.c: Same.
        * io/unix.c: Same.
        * io/read.c (si_max): Protect declaration of value.

From-SVN: r198603
2013-05-04 17:23:11 -04:00
Janne Blomqvist c033f5ae32 PR 56981 Improve unbuffered performance on special files.
2013-04-29  Janne Blomqvist  <jb@gcc.gnu.org>

        PR fortran/56981
        * io/transfer.c (next_record_w_unf): First fix head marker, then
        write tail.
        (next_record): Call flush_if_unbuffered.
        * io/unix.c (struct unix_stream): Add field unbuffered.
        (flush_if_unbuffered): New function.
        (fd_to_stream): New argument.
        (open_external): Fix fd_to_stream call.
        (input_stream): Likewise.
        (output_stream): Likewise.
        (error_stream): Likewise.
        * io/unix.h (flush_if_unbuffered): New prototype.

From-SVN: r198390
2013-04-29 11:42:00 +03:00
Tobias Burnus 95bd9622ab list_read.c (finish_separator): Initialize variable.
2013-04-15  Tobias Burnus  <burnus@net-b.de>

        * list_read.c (finish_separator): Initialize variable.

From-SVN: r197969
2013-04-15 14:45:06 +02:00
Tobias Burnus 71879a86ef re PR libfortran/56810 (record-repeat fails kind check on complex read)
2013-04-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56810
        * io/list_read.c (check_type): Fix kind checking for COMPLEX.

2013-04-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56810
        * gfortran.dg/read_repeat_2.f90: New.

From-SVN: r197479
2013-04-04 13:24:15 +02:00
Jerry DeLisle ba82932537 re PR fortran/56660 (Fails to read NAMELIST with certain form array syntax)
2013-04-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/56660
	* io/list_read.c (nml_read_obj): Do not reset the read error flag
	inside nml_read_obj. If the read error flag is found set just exit.
	Fix some whitespace on comments.
	(nml_read_obj_data): Reset the read error flag before the first call
	to nml_read_object.

From-SVN: r197321
2013-04-01 20:30:41 +00:00
Jerry DeLisle 83437e6709 re PR libfortran/56786 (Namelist read fails with designators containing embedded spaces)
2013-03-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/56786
	* io/list_read.c (nml_parse_qualifier): Remove spurious next_char call
	when checking for EOF. Use error return mechanism when EOF detected.
	Do not return false unless parse_err_msg and parse_err_msg_size have
	been set. Use hit_eof.
	(nml_get_obj_data): Likewise use the correct error mechanism.
	* io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist
	mode.

From-SVN: r197290
2013-03-31 20:32:33 +00:00
Tobias Burnus 357aee9210 re PR libfortran/56737 (Wrong I/O result with format cache for Hollerith strings)
2012-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56737
        * io/format.c (parse_format_list): Also cache FMT_STRING.
        (parse_format): Update call.

From-SVN: r197230
2013-03-29 10:39:47 +01:00
Tobias Burnus d80b9b4777 re PR libfortran/56737 (Wrong I/O result with format cache for Hollerith strings)
2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56737
        * io/format.c (parse_format): With caching, copy
        dtp->format string.
        (save_parsed_format): Use dtp->format directy without
        copying.

2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56737
        * testsuite/gfortran.dg/fmt_cache_3.f90: New.

(Plus: Move fortran/ChangeLog item to libgfortran/ChangeLog)

From-SVN: r197229
2013-03-29 10:37:37 +01:00
Tobias Burnus a0b012be6a re PR fortran/56735 (Namelist Read Error with question marks)
2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * io/list_read.c (nml_query): Only abort when
        an error occured.
        (namelist_read): Add goto instead of falling through.

2013-03-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56735
        * gfortran.dg/namelist_80.f90: New.

From-SVN: r197228
2013-03-29 10:32:57 +01:00
Tilo Schwarz 6f6fafc9ef re PR fortran/52512 (Cannot match namelist object name)
2013-03-25  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/52512
        * io/list_read.c (nml_parse_qualifier): To check for a derived type
        don't use the namelist head element type but the current element type.
        (nml_get_obj_data): Add current namelist element type to
        nml_parse_qualifier call.

2013-03-25  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/52512
        * gfortran.dg/namelist_79.f90: New.

From-SVN: r197061
2013-03-25 20:11:20 +00:00
Tobias Burnus a73421c460 re PR libfortran/56696 (Formatted (list-directed) input fails to signal end of record)
2013-03-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56696
        * io/list_read.c (read_real): Fix EOF diagnostic.

2013-03-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/56696
        * gfortran.dg/eof_5.f90: New.

From-SVN: r197019
2013-03-24 11:16:33 +01:00
Tilo Schwarz a0b67fe26f re PR fortran/51825 (Fortran runtime error: Cannot match namelist object name)
2013-03-20  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/51825
        * io/list_read.c (nml_read_obj): Don't end the component loop on
        a nested derived type, but continue with the next loop iteration.
        (nml_get_obj_data): Don't move the first_nl pointer further in
        the list if a qualifier was found.

2013-03-20  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/51825
        * gcc/testsuite/gfortran.dg/namelist_77.f90: New.
        * gcc/testsuite/gfortran.dg/namelist_78.f90: New.

From-SVN: r196806
2013-03-20 08:56:02 +01:00
Tilo Schwarz 09c7dc636d re PR libfortran/48618 (Negative unit number in OPEN(...) is sometimes allowed)
2013-03-20  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/48618
        * io/open.c (st_open): Raise error for unit number < 0 only if
        unit number does not exist already.

2013-03-20  Tilo Schwarz  <tilo@tilo-schwarz.de>

        PR libfortran/48618
        * gfortran.dg/open_negative_unit_1.f90: New.

From-SVN: r196805
2013-03-20 08:45:49 +01:00