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-28 Daniel Kraft <d@domob.eu>
* intrinsics/string_intrinsics.c: #include <assert.h>
* intrinsics/string_intrinsics_inc.c (string_trim): Use string_len_trim
instead of calculating the length directly.
(string_len_trim): For KIND=1, speed search up.
2009-03-28 Daniel Kraft <d@domob.eu>
* gfortran.dg/trim_1.f90: New test.
From-SVN: r145192
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-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-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-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-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
PR fortran/31832
* acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_POWF): New autoconf check for
broken powf.
* configure.ac (LIBGFOR_CHECK_FOR_BROKEN_POWF): Use it.
* intrinsics/c99_functions.c: Use internal powf implementation if
HAVE_BROKEN_POWF is defined.
* configure: Rebuilt.
* config.h.in: Rebuilt.
From-SVN: r142952
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-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-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-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-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-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
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-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-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-11-01 Dennis Wassel <dennis.wassel@gmail.com>
PR fortran/37159
* fortran/check.c (gfc_check_random_seed): Check PUT size
at compile time.
2008-11-01 Dennis Wassel <dennis.wassel@gmail.com>
PR fortran/37159
* intrinsics/random.c: Added comment to adapt check.c, should
kiss_size change.
Few cosmetic changes to existing comments.
2008-11-01 Dennis Wassel <dennis.wassel@gmail.com>
PR fortran/37159
* gfortran.dg/random_seed_1.f90: New testcase.
From-SVN: r141511
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-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-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-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-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-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-10 Tobias Burnus <burnus@net-b.de>
H. J. Lu <hongjiu.lu@intel.com>
* mk-sik-inc.sh: Make -Wunused-variable proof.
* mk-srk-inc.sh: Make -Wunused-variable proof.
Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
From-SVN: r140239
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-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-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-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/36886
* Makefile.am: Added $(i_cshift0_c).
Added $(i_cshift0_c) to gfor_built_specific_src.
Add rule to build from cshift0.m4.
* Makefile.in: Regenerated.
* libgfortran.h: Addedd prototypes for cshift0_i1,
cshift0_i2, cshift0_i4, cshift0_i8, cshift0_i16,
cshift0_r4, cshift0_r8, cshift0_r10, cshift0_r16,
cshift0_c4, cshift0_c8, cshift0_c10, cshift0_c16.
Define Macros GFC_UNALIGNED_C4 and GFC_UNALIGNED_C8.
* intrinsics/cshift0.c: Remove helper functions for
the innter shift loop.
(cshift0): Call specific functions depending on type
of array argument. Only call specific functions for
correct alignment for other types.
* m4/cshift0.m4: New file.
* generated/cshift0_i1.c: New file.
* generated/cshift0_i2.c: New file.
* generated/cshift0_i4.c: New file.
* generated/cshift0_i8:.c New file.
* generated/cshift0_i16.c: New file.
* generated/cshift0_r4.c: New file.
* generated/cshift0_r8.c: New file.
* generated/cshift0_r10.c: New file.
* generated/cshift0_r16.c: New file.
* generated/cshift0_c4.c: New file.
* generated/cshift0_c8.c: New file.
* generated/cshift0_c10.c: New file.
* generated/cshift0_c16.c: New file.
2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/36886
* gfortran.dg/cshift_char_3.f90: New test case.
* gfortran.dg/cshift_nan_1.f90: New test case.
From-SVN: r139111
2008-07-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/36582
* io/list_read.c: If variable rank is zero, do not adjust the found
namelist object pointer. Fix ChangeLog.
From-SVN: r138914
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-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-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-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/36773
* intrinsics/cshift0.c (cshift0): Return early if size of array
is zero.
* intrinsics/eoshift0.c (eoshift0): Return early if size of
return array is zero.
* intrinsics/eoshift2.c (eoshift2): Likewise.
* m4/eoshift1.m4 (eoshift1): Return early if size of array
is zero.
* m4/eoshift3.m4 (eoshift3): Likewise.
* m4/eoshift2.m4 (eoshift2): Return early if size of return
array is zero.
* m4/eoshift4.m4 (eoshift2): Return early if size of return
array is zero.
* generated/cshift1_16.c: Regenerated.
* generated/cshift1_4.c: Regenerated.
* generated/cshift1_8.c: Regenerated.
* generated/eoshift1_16.c: Regenerated.
* generated/eoshift1_4.c: Regenerated.
* generated/eoshift1_8.c: Regenerated.
* generated/eoshift3_16.c: Regenerated.
* generated/eoshift3_4.c: Regenerated.
* generated/eoshift3_8.c: Regenerated.
2008-07-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/36773
* gfortran.dg/zero_sized_5.f90: New test case.
From-SVN: r138027
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-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-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-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-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
PR fortran/36319
* intrinsic.c (gfc_convert_chartype): Don't mark conversion
function as pure.
* trans-array.c (gfc_trans_array_ctor_element): Divide element
size by the size of one character to obtain length.
* iresolve.c (gfc_resolve_cshift): Call the _char4 variant when
appropriate.
(gfc_resolve_eoshift): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Minor beautification.
(gfc_conv_intrinsic_fdate): Minor beautification.
(gfc_conv_intrinsic_ttynam): Minor beautification.
(gfc_conv_intrinsic_minmax_char): Allow all character kinds.
(size_of_string_in_bytes): New function.
(gfc_conv_intrinsic_size): Call size_of_string_in_bytes for
character expressions.
(gfc_conv_intrinsic_sizeof): Likewise.
(gfc_conv_intrinsic_array_transfer): Likewise.
(gfc_conv_intrinsic_trim): Allow all character kinds. Minor
beautification.
(gfc_conv_intrinsic_repeat): Fix comment typo.
* simplify.c (gfc_convert_char_constant): Take care of conversion
of array constructors.
* intrinsics/string_intrinsics_inc.c (string_index): Return
correct value for zero-length substring.
* intrinsics/cshift0.c: Add _char4 variant.
* intrinsics/eoshift0.c (eoshift0): Allow filler to be a pattern
wider than a single byte. Add _char4 variant and use above
functionality.
* intrinsics/eoshift2.c (eoshift2): Likewise.
* m4/eoshift1.m4: Likewise.
* m4/eoshift3.m4: Likewise.
* m4/cshift1.m4: Add _char4 variants.
* gfortran.map (GFORTRAN_1.1): Add _gfortran_cshift0_1_char4,
_gfortran_cshift0_2_char4, _gfortran_cshift0_4_char4,
_gfortran_cshift0_8_char4, _gfortran_cshift1_16_char4,
_gfortran_cshift1_4_char4, _gfortran_cshift1_8_char4,
_gfortran_eoshift0_1_char4, _gfortran_eoshift0_2_char4,
_gfortran_eoshift0_4_char4, _gfortran_eoshift0_8_char4,
_gfortran_eoshift1_16_char4, _gfortran_eoshift1_4_char4,
_gfortran_eoshift1_8_char4, _gfortran_eoshift2_1_char4,
_gfortran_eoshift2_2_char4, _gfortran_eoshift2_4_char4,
_gfortran_eoshift2_8_char4, _gfortran_eoshift3_16_char4,
_gfortran_eoshift3_4_char4 and _gfortran_eoshift3_8_char4.
* generated/eoshift3_4.c: Regenerate.
* generated/eoshift1_8.c: Regenerate.
* generated/eoshift1_16.c: Regenerate.
* generated/cshift1_4.c: Regenerate.
* generated/eoshift1_4.c: Regenerate.
* generated/eoshift3_8.c: Regenerate.
* generated/eoshift3_16.c: Regenerate.
* generated/cshift1_8.c: Regenerate.
* generated/cshift1_16.c: Regenerate.
* gfortran.dg/widechar_5.f90: New file.
* gfortran.dg/widechar_6.f90: New file.
* gfortran.dg/widechar_7.f90: New file.
* gfortran.dg/widechar_intrinsics_5.f90: Uncomment the lines
testing the SPREAD intrinsic.
* gfortran.dg/widechar_intrinsics_6.f90: New file.
* gfortran.dg/widechar_intrinsics_7.f90: New file.
* gfortran.dg/widechar_intrinsics_8.f90: New file.
* gfortran.dg/widechar_intrinsics_9.f90: New file.
* gfortran.dg/widechar_intrinsics_10.f90: New file.
From-SVN: r136129
* runtime/select.c: Moved content to select_inc.c. Include it.
Add macros for different character types.
* runtime/select_inc.c: New file.
* runtime/convert_char.c: New file.
* intrinsics/pack_generic.c (pack_char4, pack_s_char4): New
functions.
* intrinsics/transpose_generic.c (transpose_char4): New function.
* intrinsics/spread_generic.c (spread_char4, spread_char4_scalar):
New functions.
* intrinsics/unpack_generic.c (unpack1_char4, unpack0_char4):
New functions.
* intrinsics/reshape_generic.c (reshape_char): Use
gfc_charlen_type as type for length variables.
(reshape_char4): New function.
* gfortran.map (GFORTRAN_1.1): Add _gfortran_select_string_char4,
_gfortran_convert_char1_to_char4, _gfortran_convert_char4_to_char1,
_gfortran_transpose_char4, _gfortran_spread_char4,
_gfortran_spread_char4_scalar, _gfortran_reshape_char4,
_gfortran_pack_char4, _gfortran_pack_s_char4,
_gfortran_unpack0_char4 and _gfortran_unpack1_char4.
* Makefile.am: Add runtime/convert_char.c.
* Makefile.in: Regenerate.
From-SVN: r135496
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-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-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35990
* intrinsics/pack_generic.c: If an extent of the source
array is less then zero, set it to zero. Set the source
pointer to NULL if the source size is zero. Set the total
number of elements to zero if the vector has an extent
less or equal to zero.
* m4/pack.m4: Set the source pointer to NULL if the
source array is zero-sized. Set the total number of
elemements to zero if the vector has an extent less or
equal to zero.
* generated/pack_i1.c: Regenerated.
* generated/pack_i2.c: Regenerated.
* generated/pack_i4.c: Regenerated.
* generated/pack_i8.c: Regenerated.
* generated/pack_i16.c: Regenerated.
* generated/pack_r4.c: Regenerated.
* generated/pack_r8.c: Regenerated.
* generated/pack_r10.c: Regenerated.
* generated/pack_r16.c: Regenerated.
* generated/pack_c4.c: Regenerated.
* generated/pack_c8.c: Regenerated.
* generated/pack_c10.c: Regenerated.
* generated/pack_c16.c: Regenerated.
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35990
* gfortran.dg/intrinsic_pack_4.f90: New test case.
From-SVN: r134927
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-04-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
* intrinsics/spread_generic.c (spread): Use spread_i2()
for GFC_DTYPE_DERIVED_2 (fix typo from previous commit).
From-SVN: r134286
2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/32972
PR libfortran/32512
configure.ac: Add test for uintptr_t.
configure: Regenerated.
config.h.in: Regenerated.
* libgfortran.h: GFC_DTYPE_DERIVED_1: New macro.
GFC_DTYPE_DERIVED_2: New macro.
GFC_DTYPE_DERIVED_4: New macro.
GFC_DTYPE_DERIVED_8: New macro.
GFC_DTYPE_DERIVED_16: New macro.
GFC_UNALIGNED_2: New macro.
GFC_UNALIGNED_4: New macro.
GFC_UNALIGNED_8: New macro.
GFC_UNALIGNED_16: New macro.
intptr_t: Define if we don't have it.
uintptr_t: Likewise.
* runtime/backtrace.c (show_backtrace): Use intptr_t.
* intrinsics/signal.c (signal_sub): Likewise.
(signal_sub_int): Likewise.
(alarm_sub_int_i4): Likewise.
* intrinsics/spread_generic.c (spread): Use the integer
routines for handling derived types of sizes 1, 2, 4, 8 and 16
if the alignment of all pointers is correct.
(spread_scalar): Likewise.
* intrinsics/pack_generic.c (pack): Likewise.
Use GFD_DTYPE_TYPE_SIZE to avoid nested switch statements.
* intrinsics/unpack_generic.c (unpack1): Likewise.
(unpack0): Likewise.
* runtime/in_pack_generic.c (internal_pack): Likewise.
* runtime/in_unpack_generic.c (internal_unpack): Likewise.
2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
PR libfortran/32512
* gfortran.dg/internal_pack_1.f90: Add test for derived type.
* gfortran.dg/intrinsic_spread_1.f90: Likewise.
* gfortran.dg/intrinsic_pack_1.f90: Likewise.
* gfortran.dg/intrinsic_unpack_1.f90: Likewise.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r134245
* 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-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-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-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
PR libfortran/32512
* Makefile.am: Add new variable, i_spread_c, containing
pack_i1.c, pack_i2.c, pack_i4.c, pack_i8.c, spread_i16.c,
spread_r4.c, spread_r8.c, spread_r10.c, spread_r16.c,
spread_c4.c, spread_c8.c, spread_c10.c, spread_c16.c.
* Makefile.in: Regenerated.
* libgfortran.h: Add prototypes for spread_i1, spread_i2,
spread_i4, spread_i8, spread_i16, spread_r4, spread_r8,
spread_c4, spread_c8, spread_c10, spread_c16,
spread_scalar_i1, spread_scalar_i2, spread_scalar_i4,
spread_scalar_i8, spread_scalar_i16, spread_scalar_r4
spread_scalar_r8, spread_scalar_c4, spread_scalar_c8,
spread_scalar_c10 and spread_scalar_c16.
Add macros to isolate both type and size information
from array descriptors with a single mask operation.
* intrinsics/spread_generic.c: Add calls to specific
spread functions.
* m4/spread.m4: New file.
* generated/spread_i1.c: New file.
* generated/spread_i2.c: New file.
* generated/spread_i4.c: New file.
* generated/spread_i8.c: New file.
* generated/spread_i16.c: New file.
* generated/spread_r4.c: New file.
* generated/spread_r8.c: New file.
* generated/spread_r10.c: New file.
* generated/spread_r16.c: New file.
* generated/spread_c4.c: New file.
* generated/spread_c8.c: New file.
* generated/spread_c10.c: New file.
* generated/spread_c16.c: New file.
2008-03-28 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
PR libfortran/32512
* intrinsic_spread_1.f90: New file.
* intrinsic_spread_2.f90: New file.
* intrinsic_spread_3.f90: New file.
From-SVN: r133702
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 Tobias Burnus <burnus@net-b.de>
PR fortran/35721
* intrinsics/associated.c (associated): Ignore different
stride of pointer vs. target if only one element is referred.
2008-03-28 Tobias Burnus <burnus@net-b.de>
PR fortran/35721
* gfortran.dg/associated_target_2.f90: New.
From-SVN: r133684
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-21 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.map: Move erfc_scaled symbols to new symbol node
GFORTRAN_1.1, thereby fixing ABI bug introduced in r132846.
From-SVN: r133432
2008-03-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
* Makefile.am: Add new variable, i_pack_c, containing
pack_i1.c, pack_i2.c, pack_i4.c, pack_i8.c, pack_i16.c,
pack_r4.c, pack_r8.c, pack_r10.c, pack_r16.c, pack_c4.c,
pack_c8.c, pack_c10.c, pack_c16.c.
Add m4/pack.m4 to m4_files.
Add i_pack_c to gfor_built_src.
Add rule to generate i_pack_c from m4/pack.m4.
* Makefile.in: Regenerated.
* libgfortran.h: Add prototypes for pack_i1, pack_i2, pack_i4,
pack_i8, pack_i16, pack_r4, pack_r8, pack_c4, pack_c8,
pack_c10, pack_c16.
* intrinsics/pack_generic.c: Add calls to specific
pack functions.
* m4/pack.m4: New file.
* generated/pack_i1.c: New file.
* generated/pack_i2.c: New file.
* generated/pack_i4.c: New file.
* generated/pack_i8.c: New file.
* generated/pack_i16.c: New file.
* generated/pack_r4.c: New file.
* generated/pack_r8.c: New file.
* generated/pack_r10.c: New file.
* generated/pack_r16.c: New file.
* generated/pack_c4.c: New file.
* generated/pack_c8.c: New file.
* generated/pack_c10.c: New file.
* generated/pack_c16.c: New file.
2008-03-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
* internal_pack_1.f90: New test case.
* internal_pack_2.f90: New test case.
* internal_pack_3.f90: New test case.
From-SVN: r133427
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-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
PR libfortran/32812
* intrinsics/random.c (scramble_seed, unscramble_seed): New
functions.
(random_seed_i4): Scramble the seed the user gives us before
storing it, and unscramble it when we return it back later.
From-SVN: r133104
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-02-25 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/29549
* Makefile.am: Add -fcx-fortran-rules to AM_CFLAGS for all of
libgfortran.
* Makefile.in: Regenerated.
From-SVN: r132638
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-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-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-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35001
* m4/shape.m4: Return 0 for extents <= 0.
* generated/shape_i4.c: Regenerated.
* generated/shape_i8.c: Regenerated.
* generated/shape_i16.c: Regenerated.
2008-02-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35001
* gfortran.dg/shape_4.f90: New test.
Fixed in regression-only mode by special dispense (see the PR).
From-SVN: r132070
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-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-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-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-16 Steven Bosscher <steven@gcc.gnu.org>
PR libfortran/34669
* mk-kinds-h.sh: Compile with -S to avoid calling the assembler,
to avoid piping the -fdump-parse-tree output to the assembler
when configuring with -pipe.
* mk-sik-inc.sh: Likewise.
* mk-srk-inc.sh: Likewise.
From-SVN: r131567
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-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
2007-12-27 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34594
* runtime/error.c: If there was a previous error, don't
mask it with another error mesage, EOF or EOR condition.
2007-12-27 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34594
* gfortran.dg/direct_io_8.f90: New test case.
From-SVN: r131199
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
gcc/fortran:
2007-12-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34533
* intrinsic.h (gfc_check_etime): Renamed to ...
(gfc_check_dtime_etime): ... this.
(gfc_check_etime_sub): Renamed to ...
(gfc_check_dtime_etime_sub): ... this.
(gfc_resolve_dtime_sub): New prototype.
* check.c (gfc_check_etime): Renamed to ...
(gfc_check_dtime_etime): ... this.
(gfc_check_etime_sub): Renamed to ...
(gfc_check_dtime_etime_sub): ... this.
* iresolve.c (gfc_resolve_dtime_sub): New implementation.
* intrinsic.c (add_functions): Removed alias from ETIME to DTIME,
added stand-alone intrinsic DTIME.
(add_subroutines): Adjusted check and resolve function names for
DTIME and ETIME.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Added DTIME
to known functions in switch.
* intrinsic.texi (DTIME): Added paragraph about thread-safety,
fixed return value section.
(CPU_TIME): Clarified intent and added implementation notes.
libgfortran:
2007-12-25 Daniel Franke <franke.daniel@gmail.com>
PR fortran/34533
* intrinsics/cpu_time.c: Moved code commonly usable for CPU_TIME,
DTIME and ETIME to ...
* intrinsics/time_1.h: ... here.
* intrinsics/dtime.c: New file.
* intrinsics/etime.c: Newly implemented using the common
time-aquisition function from time_1.h.
* gfortran.map (_gfortran_dtime, _gfortran_dtime_sub): New.
* Makefile.am: Added new file.
* Makefile.in: Regenerated.
* configure: Regenerated.
From-SVN: r131168
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-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-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-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-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-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-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-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-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33253
* io/list_read.c (read_character): Use line_buffer to scan ahead for
object name or string when no delimiter is found.
From-SVN: r129016
2007-10-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33253
* io/list_read.c (read_character): Use DELIM_APOSTROPHE and DELIM_QUOTE
and quote value in check of first character in string.
From-SVN: r128973
2007-09-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33400
* io/list_read.c (next_char): Interpret encountering the end of file the
first time as an end of line. Subsequent reads give EOF error.
From-SVN: r128868
PR libfortran/23272
* io/unix.c (id_from_handle, id_from_path, id_from_fd): New
functions.
(compare_file_filename, find_file, find_file0): Use the new
functions above.
* gfortran.dg/inquire_10.f90: New test.
From-SVN: r128636