aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io
AgeCommit message (Collapse)AuthorFilesLines
2009-04-30Fix PR libfortran/39667Janne Blomqvist2-19/+15
From-SVN: r147004
2009-04-18re PR fortran/39782 (IO depends on uninitialised value)Janne Blomqvist1-6/+0
2009-04-18 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/39782 * io/transfer.c (data_transfer_init): Don't flush before seek. (finalize_transfer): Remove extra flush. From-SVN: r146308
2009-04-17io.h (is_preconnected): Remove prototype.Janne Blomqvist2-14/+0
2009-04-17 Janne Blomqvist <jb@gcc.gnu.org> * io/io.h (is_preconnected): Remove prototype. * io/unix.c (is_preconnected): Remove function. From-SVN: r146287
2009-04-15re PR libfortran/38668 (advance="no": no buffering, truncate and seek)Janne Blomqvist1-1/+0
2009-04-15 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/38688 * io/transfer.c (finalize_transfer): Don't flush for advance='no'. From-SVN: r146134
2009-04-15write.c (itoa): Rename back to gfc_itoa.Danny Smith1-4/+9
* io/write.c (itoa) : Rename back to gfc_itoa. (write_i): Adjust call to write_decimal. (write_integer): Use gfc_itoa. From-SVN: r146079
2009-04-10io.h (move_pos_offset): Remove prototype.Janne Blomqvist3-30/+2
2009-04-10 Janne Blomqvist <jb@gcc.gnu.org> * io/io.h (move_pos_offset): Remove prototype. * io/transfer.c (formatted_transfer_scalar_read): Use sseek instead of move_pos_offset. * io/unix.c (move_pos_offset): Remove. From-SVN: r145876
2009-04-10PR libfortran/39665 libfortran/39702 libfortran/39709Janne Blomqvist2-15/+29
2009-04-10 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/39665 libfortran/39702 libfortran/39709 * io/io.h (st_parameter_dt): Revert aligned attribute from u.p.value. * io/list_read.c (read_complex): Read directly into user pointer. (read_real): Likewise. (list_formatted_read_scalar): Update read_complex and read_real calls. (nml_read_obj): Read directly into user pointer. From-SVN: r145875
2009-04-09re PR libfortran/39665 (Fortran IO using unaligned accesses to read/write ↵Janne Blomqvist2-6/+9
doubles.) 2009-04-09 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/39665 * io/io.h (st_parameter_dt): Add aligned attribute to u.p.value. * io/read.c (convert_real): Add note about alignment requirements. From-SVN: r145852
2009-04-09Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.Jakub Jelinek17-248/+165
From-SVN: r145841
2009-04-08open.c (already_open): Test for POSIX close return value.Janne Blomqvist3-3/+3
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org> * io/open.c (already_open): Test for POSIX close return value. * io/unit.c (close_unit_1): Likewise. * io/unix.c (raw_close): Return 0 for success for preconnected units. From-SVN: r145761
2009-04-08string.c (compare0): Use gfc_charlen_type.Janne Blomqvist5-64/+90
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org> * runtime/string.c (compare0): Use gfc_charlen_type. * runtime/error.c (gfc_itoa): Move to io/write.c (xtoa): Rename to gfc_xtoa. * runtime/backtrace.c (show_backtrace): Call gfc_xtoa. * intrinsics/cshift0.c (cshift0): Use index_type for shift arg. * intrinsics/date_and_time.c (date_and_time): Use index_type. (itime_i4): Likewise. (itime_i8): Likewise. (idate_i4): Likewise. (idate_i8): Likewise. (gmtime_i4): Likewise. (gmtime_i8): Likewise. (ltime_i4): Likewise. (ltime_i8): Likewise. * libgfortran.h (gfc_itoa): Remove prototype. (xtoa): Rename prototype to gfc_xtoa. * io/list_read.c (nml_read_obj): Use size_t for string length. * io/transfer.c (read_block_direct): Change nbytes arg from pointer to value. (unformatted_read): Minor cleanup, call read_block_directly properly. (skip_record): Use ssize_t. (next_record_w_unf): Avoid stell() call by calling sseek with SEEK_CUR. (iolength_transfer): Make sure to multiply before cast. * io/intrinsics.c (fgetc): Remove unnecessary variable. * io/format.c (format_hash): Use gfc_charlen_type. * io/write.c (itoa): Move from runtime/error.c:gfc_itoa, rename, make static. (write_i): Call with pointer to itoa. (write_z): Call with pointer to gfc_xtoa. (write_integer): Pointer to itoa. (nml_write_obj): Type cleanup, don't call strlen in loop. From-SVN: r145758
2009-04-06re PR libfortran/39664 (Revision 145571 breaks stdio)H.J. Lu1-1/+6
2009-04-06 H.J. Lu <hongjiu.lu@intel.com> PR libgfortran/39664 * io/unix.c (raw_close): Don't close STDOUT_FILENO, STDERR_FILENO nor STDIN_FILENO. From-SVN: r145636
2009-04-06io.h (struct stream): Rename truncate to trunc.David Edelsohn2-5/+6
* io/io.h (struct stream): Rename truncate to trunc. (struncate): Same. * io/unix.c (raw_init): Rename truncate to trunc. (buf_init): Same. (open_internal): Same. From-SVN: r145608
2009-04-05[multiple changes]Jerry DeLisle12-1752/+1942
2009-04-05 Daniel Kraft <d@domob.eu> PR fortran/38654 * io/read.c (read_f): Reworked to speed up floating point parsing. (convert_real): Use pointer-casting instead of memcpy and temporaries. 2009-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37754 * io/io.h (format_hash_entry): New structure for hash table. (format_hash_table): The hash table itself. (free_format_data): Revise function prototype. (free_format_hash_table, init_format_hash, free_format_hash): New function prototypes. * io/unit.c (close_unit_1): Use free_format_hash_table. * io/transfer.c (st_read_done, st_write_done): Free format data if internal unit. * io/format.c (free_format_hash_table): New function that frees any memory allocated previously for cached format data. (reset_node): New static helper function to reset the format counters for a format node. (reset_fnode_counters): New static function recursively calls reset_node to traverse the fnode tree. (format_hash): New simple hash function based on XOR, probabalistic, tosses collisions. (save_parsed_format): New static function to save the parsed format data to use again. (find_parsed_format): New static function searches the hash table looking for a match. (free_format_data): Revised to accept pointer to format data rather than the dtp pointer so that the function can be used in more places. (format_lex): Editorial. (parse_format_list): Set flag used to determine of format data hashing is to be used. Internal units are not persistent enough for this. (revert): Move to ne location in file. (parse_format): Use new functions to look for previously parsed format strings and use them rather than re-parse. If not found, saves the parsed format data for later use. 2009-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37754 * io/transfer.c (formatted_transfer_scalar): Remove this function by factoring it into two new functions, one for read and one for write, eliminating all the conditionals for read or write mode. (formatted transfer_scalar_read): New function. (formatted transfer_scalar_write): New function. (formatted_transfer): Use new functions. 2009-04-05 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/25561 libfortran/37754 * io/io.h (struct stream): Define new stream interface function pointers, and inline functions for accessing it. (struct fbuf): Use int instead of size_t, remove flushed element. (mem_alloc_w): New prototype. (mem_alloc_r): New prototype. (stream_at_bof): Remove prototype. (stream_at_eof): Remove prototype. (file_position): Remove prototype. (flush): Remove prototype. (stream_offset): Remove prototype. (unit_truncate): New prototype. (read_block_form): Change to return pointer, int* argument. (hit_eof): New prototype. (fbuf_init): Change prototype. (fbuf_reset): Change prototype. (fbuf_alloc): Change prototype. (fbuf_flush): Change prototype. (fbuf_seek): Change prototype. (fbuf_read): New prototype. (fbuf_getc_refill): New prototype. (fbuf_getc): New inline function. * io/fbuf.c (fbuf_init): Use int, get rid of flushed. (fbuf_debug): New function. (fbuf_reset): Flush, and return position offset. (fbuf_alloc): Simplify, don't flush, just realloc. (fbuf_flush): Make usable for read mode, salvage remaining bytes. (fbuf_seek): New whence argument. (fbuf_read): New function. (fbuf_getc_refill): New function. * io/file_pos.c (formatted_backspace): Use new stream interface. (unformatted_backspace): Likewise. (st_backspace): Make sure format buffer is reset, use new stream interface, use unit_truncate. (st_endfile): Likewise. (st_rewind): Likewise. * io/intrinsics.c: Use new stream interface. * io/list_read.c (push_char): Don't use u.p.scratch, use realloc to resize. (free_saved): Don't check u.p.scratch. (next_char): Use new stream interface, use fbuf_getc() for external files. (finish_list_read): flush format buffer. (nml_query): Update to use modified interface:s * io/open.c (test_endfile): Use new stream interface. (edit_modes): Likewise. (new_unit): Likewise, set bytes_left to 1 for stream files. * io/read.c (read_l): Use new read_block_form interface. (read_utf8): Likewise. (read_utf8_char1): Likewise. (read_default_char1): Likewise. (read_utf8_char4): Likewise. (read_default_char4): Likewise. (read_a): Likewise. (read_a_char4): Likewise. (read_decimal): Likewise. (read_radix): Likewise. (read_f): Likewise. * io/transfer.c (read_sf): Use fbuf_read and mem_alloc_r, remove usage of u.p.line_buffer. (read_block_form): Update interface to return pointer, use fbuf_read for direct access. (read_block_direct): Update to new stream interface. (write_block): Use mem_alloc_w for internal I/O. (write_buf): Update to new stream interface. (formatted_transfer_scalar): Don't use u.p.line_buffer, use fbuf_seek for external files. (us_read): Update to new stream interface. (us_write): Likewise. (data_transfer_init): Always check if we switch modes and flush. (skip_record): Use new stream interface, fix comparison. (next_record_r): Check for and reset u.p.at_eof, use new stream interface, use fbuf_getc for spacing. (write_us_marker): Update to new stream interface, don't inline. (next_record_w_unf): Likewise. (sset): New function. (next_record_w): Use new stream interface, use fbuf for printing newline. (next_record): Use new stream interface. (finalize_transfer): Remove sfree call, use new stream interface. (st_iolength_done): Don't use u.p.scratch. (st_read): Don't check for end of file. (st_read_done): Don't use u.p.scratch, use unit_truncate. (hit_eof): New function. * io/unit.c (init_units): Always init fbuf for formatted units. (update_position): Use new stream interface. (unit_truncate): New function. (finish_last_advance_record): Use fbuf to print newline. * io/unix.c: Remove unused SSIZE_MAX macro. (BUFFER_SIZE): Make static const variable rather than macro. (struct unix_stream): Remove dirty_offset, len, method, small_buffer. Order elements by decreasing size. (struct int_stream): Remove. (move_pos_offset): Remove usage of dirty_offset. (reset_stream): Remove. (do_read): Rename to raw_read, update to match new stream interface. (do_write): Rename to raw_write, update to new stream interface. (raw_seek): New function. (raw_tell): New function. (raw_truncate): New function. (raw_close): New function. (raw_flush): New function. (raw_init): New function. (fd_alloc): Remove. (fd_alloc_r_at): Remove. (fd_alloc_w_at): Remove. (fd_sfree): Remove. (fd_seek): Remove. (fd_truncate): Remove. (fd_sset): Remove. (fd_read): Remove. (fd_write): Remove. (fd_close): Remove. (fd_open): Remove. (fd_flush): Rename to buf_flush, update to new stream interface and unix_stream. (buf_read): New function. (buf_write): New function. (buf_seek): New function. (buf_tell): New function. (buf_truncate): New function. (buf_close): New function. (buf_init): New function. (mem_alloc_r_at): Rename to mem_alloc_r, change prototype. (mem_alloc_w_at): Rename to mem_alloc_w, change prototype. (mem_read): Change to match new stream interface. (mem_write): Likewise. (mem_seek): Likewise. (mem_tell): Likewise. (mem_truncate): Likewise. (mem_close): Likewise. (mem_flush): New function. (mem_sfree): Remove. (empty_internal_buffer): Cast to correct type. (open_internal): Use correct type, init function pointers. (fd_to_stream): Test whether to open file as buffered or raw. (output_stream): Remove mode set. (error_stream): Likewise. (flush_all_units_1): Use new stream interface. (flush_all_units): Likewise. (stream_at_bof): Remove. (stream_at_eof): Remove. (file_position): Remove. (file_length): Update logic to use stream interface. (flush): Remove. (stream_offset): Remove. * io/write.c (write_utf8_char4): Use int instead of size_t. (write_x): Extra safety check. (namelist_write_newline): Use new stream interface. From-SVN: r145571
2009-03-24re PR fortran/39528 (repeated entries are not read when using list-directed ↵Jerry DeLisle1-4/+4
input) 2009-03-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/39528 * io/list_read.c (list_formatted_read_scalar): Move check for read completion to just after the check for a repeated value. From-SVN: r145030
2009-03-22Revert part of patch accidentally committed to trunk rather than fortran-dev ↵Janne Blomqvist4-530/+440
(I hate svn) From-SVN: r144994
2009-03-22PR libfortran/25561 libfortran/37754Janne Blomqvist4-440/+530
2009-03-22 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/25561 libfortran/37754 * io/io.h (struct stream): Define new stream interface function pointers, and inline functions for accessing it. (struct fbuf): Use int instead of size_t, remove flushed element. (mem_alloc_w): New prototype. (mem_alloc_r): New prototype. (stream_at_bof): Remove prototype. (stream_at_eof): Remove prototype. (file_position): Remove prototype. (flush): Remove prototype. (stream_offset): Remove prototype. (unit_truncate): New prototype. (read_block_form): Change to return pointer, int* argument. (hit_eof): New prototype. (fbuf_init): Change prototype. (fbuf_reset): Change prototype. (fbuf_alloc): Change prototype. (fbuf_flush): Change prototype. (fbuf_seek): Change prototype. (fbuf_read): New prototype. (fbuf_getc_refill): New prototype. (fbuf_getc): New inline function. * io/fbuf.c (fbuf_init): Use int, get rid of flushed. (fbuf_debug): New function. (fbuf_reset): Flush, and return position offset. (fbuf_alloc): Simplify, don't flush, just realloc. (fbuf_flush): Make usable for read mode, salvage remaining bytes. (fbuf_seek): New whence argument. (fbuf_read): New function. (fbuf_getc_refill): New function. * io/file_pos.c (formatted_backspace): Use new stream interface. (unformatted_backspace): Likewise. (st_backspace): Make sure format buffer is reset, use new stream interface, use unit_truncate. (st_endfile): Likewise. (st_rewind): Likewise. * io/intrinsics.c: Use new stream interface. * io/list_read.c (push_char): Don't use u.p.scratch, use realloc to resize. (free_saved): Don't check u.p.scratch. (next_char): Use new stream interface, use fbuf_getc() for external files. (finish_list_read): flush format buffer. (nml_query): Update to use modified interface:s * io/open.c (test_endfile): Use new stream interface. (edit_modes): Likewise. (new_unit): Likewise, set bytes_left to 1 for stream files. * io/read.c (read_l): Use new read_block_form interface. (read_utf8): Likewise. (read_utf8_char1): Likewise. (read_default_char1): Likewise. (read_utf8_char4): Likewise. (read_default_char4): Likewise. (read_a): Likewise. (read_a_char4): Likewise. (read_decimal): Likewise. (read_radix): Likewise. (read_f): Likewise. * io/transfer.c (read_sf): Use fbuf_read and mem_alloc_r, remove usage of u.p.line_buffer. (read_block_form): Update interface to return pointer, use fbuf_read for direct access. (read_block_direct): Update to new stream interface. (write_block): Use mem_alloc_w for internal I/O. (write_buf): Update to new stream interface. (formatted_transfer_scalar): Don't use u.p.line_buffer, use fbuf_seek for external files. (us_read): Update to new stream interface. (us_write): Likewise. (data_transfer_init): Always check if we switch modes and flush. (skip_record): Use new stream interface, fix comparison. (next_record_r): Check for and reset u.p.at_eof, use new stream interface, use fbuf_getc for spacing. (write_us_marker): Update to new stream interface, don't inline. (next_record_w_unf): Likewise. (sset): New function. (next_record_w): Use new stream interface, use fbuf for printing newline. (next_record): Use new stream interface. (finalize_transfer): Remove sfree call, use new stream interface. (st_iolength_done): Don't use u.p.scratch. (st_read): Don't check for end of file. (st_read_done): Don't use u.p.scratch, use unit_truncate. (hit_eof): New function. * io/unit.c (init_units): Always init fbuf for formatted units. (update_position): Use new stream interface. (unit_truncate): New function. (finish_last_advance_record): Use fbuf to print newline. * io/unix.c: Remove unused SSIZE_MAX macro. (BUFFER_SIZE): Make static const variable rather than macro. (struct unix_stream): Remove dirty_offset, len, method, small_buffer. Order elements by decreasing size. (struct int_stream): Remove. (move_pos_offset): Remove usage of dirty_offset. (reset_stream): Remove. (do_read): Rename to raw_read, update to match new stream interface. (do_write): Rename to raw_write, update to new stream interface. (raw_seek): New function. (raw_tell): New function. (raw_truncate): New function. (raw_close): New function. (raw_flush): New function. (raw_init): New function. (fd_alloc): Remove. (fd_alloc_r_at): Remove. (fd_alloc_w_at): Remove. (fd_sfree): Remove. (fd_seek): Remove. (fd_truncate): Remove. (fd_sset): Remove. (fd_read): Remove. (fd_write): Remove. (fd_close): Remove. (fd_open): Remove. (fd_flush): Rename to buf_flush, update to new stream interface and unix_stream. (buf_read): New function. (buf_write): New function. (buf_seek): New function. (buf_tell): New function. (buf_truncate): New function. (buf_close): New function. (buf_init): New function. (mem_alloc_r_at): Rename to mem_alloc_r, change prototype. (mem_alloc_w_at): Rename to mem_alloc_w, change prototype. (mem_read): Change to match new stream interface. (mem_write): Likewise. (mem_seek): Likewise. (mem_tell): Likewise. (mem_truncate): Likewise. (mem_close): Likewise. (mem_flush): New function. (mem_sfree): Remove. (empty_internal_buffer): Cast to correct type. (open_internal): Use correct type, init function pointers. (fd_to_stream): Test whether to open file as buffered or raw. (output_stream): Remove mode set. (error_stream): Likewise. (flush_all_units_1): Use new stream interface. (flush_all_units): Likewise. (stream_at_bof): Remove. (stream_at_eof): Remove. (file_position): Remove. (file_length): Update logic to use stream interface. (flush): Remove. (stream_offset): Remove. * io/write.c (write_utf8_char4): Use int instead of size_t. (write_x): Extra safety check. (namelist_write_newline): Use new stream interface. [[Split portion of a mixed commit.]] From-SVN: r144993.2
2009-03-09re PR libfortran/39402 (gfortran 20090306: internal write of 0.0 with F0.3 ↵Jerry DeLisle1-1/+1
gives **) 2009-03-08 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/39409 * io/write_float.def (output_float): Handle F0.d formatting correctly for any d when value is 0.0. From-SVN: r144718
2009-01-13re PR libfortran/38772 (r143102 reveals missed error checking on floating ↵Jerry DeLisle1-2/+2
point reads) 2009-01-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38772 * io/read.c (read_f): Clean up loop conditions for BZ/BN, allowing proper digit testing. White space fix. From-SVN: r143327
2009-01-05re PR libfortran/38735 ([4.4 Regresssion] Default BLANK= mode for internal ↵Jerry DeLisle1-1/+1
units is wrong) 2009-01-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38735 * io/unit.c (get_internal_unit): Set default BLANK= status to NULL for internal units. From-SVN: r143102
2008-12-22re PR fortran/37472 (bad output on default-format write of double in common ↵Jerry DeLisle1-2/+2
block with -m64) 2008-12-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37472 * io/write_float.def (output_float_FMT_G_): Modify calculation of temp to avoid sensitivity to round-off. From-SVN: r142884
2008-12-21re PR fortran/38398 (g0.w edit descriptor: Update for F2008 Tokyo meeting ↵Jerry DeLisle4-23/+28
changes) 2008-12-21 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38398 * io/io.h (st_parameter_dt): Add new bit to keep track of when to suppress blanks for g0 formatting. * io/transfer.c (formatted_transfer_scalar): Always call write_real_g0 for g0 formatting. * io.c (write.c): Do not use ES formatting and use new bit to suppress blanks. * io/write_float.def (output_float): Adjust the location of setting the width so that it can be adjusted when suppressing blanks. Set number of blanks to zero when dtp->u.p.g0_no_blanks is set. Do some minor code clean-up and add some white space for readability. From-SVN: r142871
2008-12-14re PR fortran/38504 (double minus sign when printing integer?)Jerry DeLisle1-1/+8
2008-12-13 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38504 io/write.c (write_decimal): Skip extra sign '-' at beginning of string returned by gfc_itoa. From-SVN: r142747
2008-12-09re PR fortran/38430 (gfortran.dg/streamio_1.f90, 10, 14, 2, 6 now fails)Jerry DeLisle1-12/+13
2008-12-08 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38430 * io/transfer.c (data_transfer_init): Move constraint check for REC= and STREAM access into condition for other REC= constraints to simplify. Comment out this constraint to avoid breaking compatibility with 4.3 until later. Added a TODO for above comment and this one. Fix test for max pos. From-SVN: r142575
2008-12-06re PR fortran/38291 (Rejects I/O with POS= if FMT=*)Jerry DeLisle1-2/+14
2008-12-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38291 * io/transfer.c (data_transfer_init): Add fbuf_flush inadvertently ommitted. Add check for invalid use of REC= with ACCESS="stream". Fix comment. From-SVN: r142528
2008-12-06re PR fortran/38291 (Rejects I/O with POS= if FMT=*)Jerry DeLisle1-24/+68
2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/38291 * io.c (match_dt_element): Use dt->pos in matcher. (gfc_free_dt): Free dt->pos after use. (gfc_resolve_dt): Use dt->pos in resolution of stream position tag. 2008-12-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38291 * io/transfer.c (data_transfer_init): Add checks for POS= valid range. Add check for unit opened with ACCESS="stream". Flush and seek if current stream position does not match. Check ENDFILE on read. From-SVN: r142515
2008-12-05re PR fortran/38285 (Wrong I/O output: Interaction between F and P for output)Jerry DeLisle1-1/+2
2008-12-04 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/38285 * write_float.def (WRITE_FLOAT): Zero the float value for special case only if scale_factor = 0. From-SVN: r142455
2008-11-22re PR libfortran/37839 (st_parameter_dt has unwanted padding, is out of sync ↵Jakub Jelinek4-192/+108
with compiler) PR libfortran/37839 * trans-io.c (gfc_build_io_library_fndecls): Decrease pad size back to 16 pointers plus 32 integers. Don't use max integer kind alignment, only gfc_intio_kind's alignment. (gfc_trans_inquire): Only set flags2 if mask2 is non-zero. * ioparm.def: Fix order, bitmasks and types of inquire round, sign and pending fields. Move u in dt before id. * io.c (gfc_free_inquire): Free decimal and size exprs. (match_inquire_element): Match size instead of matching blank twice. (gfc_resolve_inquire): Resolve size. * gfortran.dg/f2003_inquire_1.f03: New test. * gfortran.dg/f2003_io_1.f03: Remove xfail. * gfortran.dg/f2003_io_4.f03: Likewise. * gfortran.dg/f2003_io_5.f03: Likewise. * gfortran.dg/f2003_io_6.f03: Likewise. * gfortran.dg/f2003_io_7.f03: Likewise. * io/io.h (IOPARM_INQUIRE_HAS_ROUND, IOPARM_INQUIRE_HAS_SIGN, IOPARM_INQUIRE_HAS_PENDING): Adjust values. (st_parameter_inquire): Reorder and fix types of round, sign and pending fields. (st_parameter_43, st_parameter_44): Removed. (st_parameter_dt): Put back struct definition directly to u.p declaration. Change type of u.p.size_used from gfc_offset to GFC_IO_INT. Decrease back size of u.pad to 16 pointers and 32 ints. Put id, pos, asynchronous, blank, decimal, delim, pad, round and sign fields after the union. * io/inquire.c (inquire_via_unit, inquire_via_filename): Only read flags2 if it is defined. * io/transfer.c (read_sf, read_block_form, write_block): Cast additions to size_used to GFC_IO_INT instead of gfc_offset. (data_transfer_init): Clear whole u.p struct. Adjust for moving id, pos, asynchronous, blank, decimal, delim, pad, round and sign fields from u.p directly into st_parameter_dt. (finalize_transfer): Don't cast size_used to GFC_IO_INT. * io/file_pos.c (st_endfile): Clear whole u.p struct. From-SVN: r142111
2008-11-21re PR fortran/37472 (bad output on default-format write of double in common ↵Jerry DeLisle1-1/+4
block with -m64) 2008-11-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37472 * io/write_float.def (output_float_FMT_G_): Adjust conversion of G format specification to F format. From-SVN: r142079
2008-11-16re PR libfortran/38097 (I/O with blanks in exponent fails; blank="NULL", BN ↵Jerry DeLisle3-11/+6
edit descriptor) 2008-11-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/38097 * io/read.c (read_f): Initialize exponent. Fix comment. Set loop conditions for BZ/BN. * io/unit.c (get_internal_unit): Initialize flags.blank. * io/transfer.c (data_transfer_init): Fix whitespace. From-SVN: r141919
2008-11-15re PR libfortran/37294 (Namelist I/O to array character internal units)Jerry DeLisle1-1/+30
2008-11-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37294 * io/write.c (namelist_write_newline): Use array loop specification to advance to next internal array unit record. (namelist_write): Adjust to accomodate the internal array unit behavior. From-SVN: r141892
2008-10-23re PR libfortran/37707 (Namelist read of array of derived type incorrect)Jerry DeLisle2-59/+3
2008-10-22 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37707 * io/list_read.c (read_character): Remove code to look ahead in namelist reads to descriminate non-delimited strings from namelist objects. * io/write.c (namelist_write): Delimit character strings with quote or apostrophe, defaulting to quote. From-SVN: r141317
2008-10-19re PR fortran/37834 (write(*,'(f0.0)') 0.0 prints "." instead of "0.")Jerry DeLisle1-0/+16
2008-10-19 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37834 * io/write_float.def (output_float): Emit '0.' for special case of format specifier 'f0.0' and value of zero. Likewise emit '0' for 'f1.0'. From-SVN: r141231
2008-10-18re PR fortran/37863 (Display of a value close but less to 1 shows 2 with ↵Jerry DeLisle2-2/+2
'(F3.0)') 2008-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37707 * io/write_float.def (WRITE_FLOAT): Round to 1.0 correctly. * io/io.h (st_parameter_44): Fix id type declaration. From-SVN: r141207
2008-10-16file_pos.c (unformatted_backspace): Normal case is GFC_CONVERT_NATIVE.Thomas Koenig2-40/+47
2008-10-16 Thomas Koenig <tkoenig@gcc.gnu.org> * io/file_pos.c (unformatted_backspace): Normal case is GFC_CONVERT_NATIVE. * io/transfer.c (read_sf): Mark paths leading to generate_error() as unlikely. (readl_block_form): Likewise. (read_block_direct): Likewise. (write_block): Likewise. (write_buf): Likewise. (us_read): Likewise. Normal case is GFC_CONVERT_NATIVE. (next_record_w_unf): Mark paths leading to generate_error() as unlikely. From-SVN: r141179
2008-10-14re PR fortran/37083 (Formatted read of line without trailing new-line fails)Jerry DeLisle1-8/+10
2008-10-13 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37083 * io/list_read.c (next_char): Simplify EOF tests and set endfile flag. (finish_list_read): Add EOF check. From-SVN: r141101
2008-10-09re PR libfortran/37753 (Convert="BIG_ENDIAN" reverses character)Thomas Koenig1-4/+4
2008-10-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/37753 * io/transfer.c (unformatted_read): CONVERT_NATIVE is the usual case. Check for kind==1 for non-byte-reversing operation. (unformatted_write): Likewise. 2008-10-09 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/37753 * gfortran.dg/convert_2.f90: New test case. From-SVN: r141008
2008-10-09re PR libfortran/37707 (Namelist read of array of derived type incorrect)Jerry DeLisle1-0/+3
2008-10-08 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37707 * io/list_read.c (nml_get_obj_data): If the first namelist object rank is greater than zero, call nml_object_read with the first object rather than the sub-object. From-SVN: r140995
2008-09-26re PR fortran/37498 (Incorrect array value returned - 4.3 ABI Broken)Jerry DeLisle7-266/+208
2008-09-25 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37498 * list_read.c (eat_separator): Revert previous patch and move delim_status, decimal_status, and pad_status to gfc_unit. (parse_real): Ditto. (read_real): Ditto. * read.c (read_a): Likewise. (read_a_char4): Likewise. (read_f): Likewise. * inquire.c (inquire_via_unit): Add missing check for IOPARM_INQUIRE_HAS_FLAGS2. (inquire_via_filename): Likewise. * io.h (unit_sign_s): Move delim_status, decimal_status, and pad_status to gfc_unit. * transfer.c (read_sf): Ditto. (read_block_form): Ditto. (formatted_transfer_scalar): Ditto. (data_transfer_init): Ditto. * write.c (write_default_char4): Ditto. (write_utf8_char4): Ditto. (write_character): Ditto. (write_real_g0): Ditto. (list_formatted_write_scalar): Ditto. (nml_write_obj): Ditto. (namelist_write): Ditto. * write_float.def (calculate_sign): Ditto. (output_float): Ditto. From-SVN: r140684
2008-09-23re PR fortran/37498 (Incorrect array value returned - 4.3 ABI Broken)Jerry DeLisle7-236/+407
2008-09-22 Jerry DeLisle <jvdelisle@gcc.gnu.org PR fortran/37498 * trans-io.c (gfc_build_io_library_fndecls): Bump pad size. (build_dt): Set mask bit for IOPARM_dt_f2003. * ioparm.def: Add IOPARM_dt_f2003. 2008-09-22 Jerry DeLisle <jvdelisle@gcc.gnu.org PR libfortran/37498 * file_pos (st_endfile): Clear memory only for libfortran 4.3 private area. * list_read.c (eat_separator): Only access F2003 I/O parameters if IOPARM_DT_HAS_F2003 bit is set. (parse_real): Ditto. (read_real): Ditto. * read.c (read_a): Likewise. (read_a_char4): Likewise though not strictly necessary. (read_f): Likewise. * io.h (unit_sign_s): New enumerator to allow duplication of st_parameter structures. (IOPARM_DT_HAS_F2003): New mask bit. (st_parameter_43): New structure copied from 4.3 version of st_paramater_dt private section. (st_parameter_44): New structure with F2003 items added. (st_parameter_dt): Modified to create union of new and old structures to allow correct memory setting for 4.3 ABI compatibility. Bumped the pad size. * transfer.c (read_sf): Do not use F2003 I/O memory areas unless IOPARM_DT_HAS_F2003 bit has been set. (read_block_form): Ditto. (formatted_transfer_scalar): Ditto. (data_transfer_init): Ditto and add comment, fix formatting. * write.c (write_default_char4): Likewise though not strictly necessary. (write_utf8_char4): Ditto. (write_character): Ditto. (write_real_g0): Ditto. (list_formatted_write_scalar): Ditto. (nml_write_obj): Ditto. (namelist_write): Ditto. * write_float.def (calculate_sign): Eliminate warning by including all cases in switch. (output_float): Output only decimal point of F2003 flag is not set. From-SVN: r140576
2008-09-02re PR fortran/37228 (F2008: Support g0.<d> edit descriptor)Jerry DeLisle4-23/+66
2008-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/37228 * io.c (check_format): Allow specifying precision with g0 format. 2008-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/37301 PR libfortran/37228 * io/io.h (write_real_g0): Declare new function to handle g0.d format. * io/transfer.c (formatted_transfer_scalar): Use new function. * io/format.c (parse_format_list): Enable g0.d. * io/write.c (write_a_char4): Delete unused var. (set_fnode_default): New function to set the default fnode w, d, and e factored from write_real. (write_real): Use new factored function. (write_real_g0): New function that sets d to that passed by g0.d format specifier and set format to ES. Default values for w and e are used from the new function, set_fnode_default. 2008-09-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/37228 * gfortran.dg/fmt_g0_4.f08: Revised test. From-SVN: r139886
2008-08-31re PR fortran/36895 (Namelist writting to internal files: Control ↵Jerry DeLisle1-16/+24
characters wrong?) 2008-08-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/36895 * io/write.c (namelist_write_newline): New function to correctly mark next records in both external and internal units. (nml_write_obj): Use new function. (namelist_write: Use new function. From-SVN: r139813
2008-08-19re PR libfortran/35863 ([F2003] Implement ENCODING="UTF-8")Tobias Burnus1-0/+1
2008-08-19 Tobias Burnus <burnus@net-b.de> PR libfortran/35863 * io/write.c (write_a_char4): Add missing variable declaration in HAVE_CRLF block. From-SVN: r139223
2008-08-16re PR libfortran/35863 ([F2003] Implement ENCODING="UTF-8")Jerry DeLisle2-107/+385
2008-08-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/35863 * intrinsics/selected_char_kind.c: Enable iso_10646. * io/read.c (typedef uchar): New type. (read_utf8): New function to read a single UTF-8 encoded character. (read_utf8_char1): New function to read UTF-8 into a KIND=1 string. (read_default_char1): New functio to read default into KIND=1 string. (read_utf8_char4): New function to read UTF-8 into a KIND=4 string. (read_default_char4): New function to read UTF-8 into a KIND=4 string. (read_a): Modify to use the new functions. (read_a_char4): Modify to use the new functions. * io/write.c (error.h): Add include. (typedef uchar): New type. (write_default_char4): New function to default write KIND=4 string. (write_utf8_char4): New function to UTF-8 write KIND=4 string. (write_a_char4): Modify to use new functions. (write_character): Modify to use new functions. From-SVN: r139147
2008-07-23re PR fortran/36582 (Namelist I/O error: Bogus "Cannot match namelist object")Jerry DeLisle1-1/+1
2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36852 * io/list_read.c: If variable rank is zero, do not adjust the found namelist object pointer. From-SVN: r138072
2008-07-22re PR fortran/29835 (Error message of unknown edit descriptor needs improvement)Daniel Kraft1-3/+7
2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * io.c (error_element), (format_locus): New static globals. (unexpected_element): Spelled out this message fully. (next_char): Keep track of locus when not MODE_STRING. (next_char_not_space): Remember last parsed element in error_element. (format_lex): Fix two indentation errors. (check_format): Use format_locus and possibly error_element for a slightly better error message on invalid format. (check_format_string): Set format_locus to start of the string expression used as format. 2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * io/format.c (struct format_data): New member error_element. (unexpected_element): Added '%c' to message. (next_char): Keep track of last parsed character in fmt->error_element. (format_error): If the message is unexpected_element, output the offending character, too. 2008-07-22 Daniel Kraft <d@domob.eu> PR fortran/29835 * gfortran.dg/fmt_error_3.f90: New test. * gfortran.dg/fmt_error_4.f90: New test. * gfortran.dg/fmt_error_5.f90: New test. From-SVN: r138063
2008-07-22re PR fortran/36890 (libgfortran/io/file_pos.c:55: warning: comparison ↵Thomas Koenig1-1/+1
between signed and unsigned) 2008-07-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/36890 * io/file_pos.c: Declare READ_CHUNK as signed to avoid signed/unsigned comparison warning in formatted_backspace. From-SVN: r138050
2008-07-21re PR libfortran/36857 (Non-English locale breaks gfortran float formatting ↵Jerry DeLisle1-25/+28
("printf is broken")) 2008-07-20 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36857 * io/write_float.def: Comment out locale dependent code and fix general comments. From-SVN: r138021
2008-07-02re PR fortran/36676 (Namelist Comments Problems)Jerry DeLisle1-2/+2
2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/36676 * io/list_read.c (find_nml_name): Use eat_separator instead of eat_line. From-SVN: r137334
2008-06-28re PR libfortran/36657 (Namelist reading bug with string constant ↵Jerry DeLisle1-3/+4
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