* gfortran.map: Move all _gfortran_* __iso_c_binding_* symbols
to GFORTRAN_7. Rename F2C_1.0 to GFORTRAN_F2C_7. Move all C99
compatibility symbols to GFORTRAN_C99_7.
From-SVN: r243839
2016-12-19 Janne Blomqvist <jb@gcc.gnu.org>
* Actually remove files that should have been removed by r243799.
This line, and those below, will be ignored--
M libgfortran/ChangeLog
D libgfortran/generated/exponent_r10.c
D libgfortran/generated/exponent_r16.c
D libgfortran/generated/exponent_r4.c
D libgfortran/generated/exponent_r8.c
D libgfortran/generated/fraction_r10.c
D libgfortran/generated/fraction_r16.c
D libgfortran/generated/fraction_r4.c
D libgfortran/generated/fraction_r8.c
D libgfortran/generated/nearest_r10.c
D libgfortran/generated/nearest_r16.c
D libgfortran/generated/nearest_r4.c
D libgfortran/generated/nearest_r8.c
D libgfortran/generated/rrspacing_r10.c
D libgfortran/generated/rrspacing_r16.c
D libgfortran/generated/rrspacing_r4.c
D libgfortran/generated/rrspacing_r8.c
D libgfortran/generated/set_exponent_r10.c
D libgfortran/generated/set_exponent_r16.c
D libgfortran/generated/set_exponent_r4.c
D libgfortran/generated/set_exponent_r8.c
D libgfortran/generated/spacing_r10.c
D libgfortran/generated/spacing_r16.c
D libgfortran/generated/spacing_r4.c
D libgfortran/generated/spacing_r8.c
D libgfortran/generated/transpose_c10.c
D libgfortran/generated/transpose_c16.c
D libgfortran/generated/transpose_c4.c
D libgfortran/generated/transpose_c8.c
D libgfortran/generated/transpose_i16.c
D libgfortran/generated/transpose_i4.c
D libgfortran/generated/transpose_i8.c
D libgfortran/generated/transpose_r10.c
D libgfortran/generated/transpose_r16.c
D libgfortran/generated/transpose_r4.c
D libgfortran/generated/transpose_r8.c
D libgfortran/intrinsics/malloc.c
D libgfortran/intrinsics/transpose_generic.c
D libgfortran/m4/exponent.m4
D libgfortran/m4/fraction.m4
D libgfortran/m4/nearest.m4
D libgfortran/m4/rrspacing.m4
D libgfortran/m4/set_exponent.m4
D libgfortran/m4/spacing.m4
D libgfortran/m4/transpose.m4
From-SVN: r243804
2016-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/78622
* io.c (format_lex): Continue of string delimiter seen.
* io/transfer.c (get_dt_format): New static function to alloc
and set the DT iotype string, handling doubled quotes.
(formatted_transfer_scalar_read,
formatted_transfer_scalar_write): Use new function.
* gfortran.dg/dtio_20.f03: New test.
From-SVN: r243765
libgfortran/ChangeLog:
2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
* caf/libcaf.h: Add new action types for (de-)registration of
allocatable components in derived type coarrays. Add _caf_is_present
prototype.
* caf/single.c (_gfortran_caf_register): Add support for registration
only and allocation of already registered allocatable components in
derived type coarrays.
(_gfortran_caf_deregister): Add mode to deallocate but not deregister
an allocatable component in a derived type coarray.
(_gfortran_caf_is_present): New function. Query whether an
allocatable component in a derived type coarray on a remote image is
allocated.
gcc/testsuite/ChangeLog:
2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray/alloc_comp_1.f90: Fix tree-dump scans to adhere
to the changed interfaces.
* gfortran.dg/coarray_alloc_comp_1.f08: Likewise.
* gfortran.dg/coarray_allocate_7.f08: Likewise.
* gfortran.dg/coarray_lib_alloc_1.f90: Likewise.
* gfortran.dg/coarray_lib_alloc_2.f90: Likewise.
* gfortran.dg/coarray_lib_alloc_3.f90: Likewise.
* gfortran.dg/coarray_lib_comm_1.f90: Likewise.
* gfortran.dg/coarray_lib_alloc_4.f90: New test.
gcc/fortran/ChangeLog:
2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
* check.c (gfc_check_allocated): By pass the caf_get call and check on
the array.
* gfortran.h: Add optional flag to gfc_caf_attr.
* gfortran.texi: Document new enum values and _caf_is_present function.
* primary.c (caf_variable_attr): Add optional flag to indicate that the
expression is reffing a component.
(gfc_caf_attr): Likewise.
* trans-array.c (gfc_array_deallocate): Handle deallocation mode for
coarray deregistration.
(gfc_trans_dealloc_allocated): Likewise.
(duplicate_allocatable): Use constants instead of
creating custom constant tree node of zero or one. Use gfc_add_modify
convenience function.
(duplicate_allocatable_coarray): This function is similar to
duplicate_allocatable but tailored to handle coarrays.
(caf_enabled): Check whether in-derived-type coarray processing is
enabled.
(caf_in_coarray): Check that in-derived-type coarray processing is
enabled and currently in a derived-typed coarray.
(gfc_caf_is_dealloc_only): Return true, when deallocate only is
desired for components in derived typed coarrays.
(structure_alloc_comps): A mode for handling coarrays, that is no
longer encode in the purpose. This makes the use cases of the
routine more flexible without repeating. Allocatable components in
derived type coarrays are now registered only when nullifying an
object and allocated before copying data into them.
(gfc_nullify_alloc_comp): Use the caf_mode of structure_alloc_comps
now.
(gfc_deallocate_alloc_comp): Likewise.
(gfc_deallocate_alloc_comp_no_caf): Likewise.
(gfc_reassign_alloc_comp_caf): Likewise.
(gfc_copy_alloc_comp): Likewise.
(gfc_copy_only_alloc_comp): Likewise.
(gfc_alloc_allocatable_for_assignment): Make use to the cheaper way of
reallocating a coarray without deregistering and reregistering it.
(gfc_trans_deferred_array): Initialize the coarray token correctly for
deferred variables and tear them down on exit.
* trans-array.h: Change some prototypes to add the coarray (de-)
registration modes. Add prototype for checking if deallocate only is
selected for components in derived typed coarrays.
* trans-decl.c (gfc_build_builtin_function_decls): Generate the
declarations for the changed/new caf-lib routines.
(gfc_trans_deferred_vars): Ensure deferred variables are (de-)
registered correctly on procedure entry/exit.
(generate_coarray_sym_init): Use constants.
* trans-expr.c (gfc_conv_procedure_call): Propagate coarray allocation
modes accordingly.
(gfc_trans_alloc_subarray_assign): Likewise.
(gfc_trans_subcomponent_assign): Likewise.
(gfc_trans_structure_assign): Generate code to register the components
of a derived type coarray prior to initialization.
(gfc_conv_structure): Set flag that the structure is in a coarray.
(gfc_trans_scalar_assign): Add flag to indicate being in a coarray and
set the structure_alloc_comps modes correctly.
(gfc_trans_assignment_1): Figure being in a coarray expression.
* trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Adapt to new
structure_alloc_comps interface.
(conv_caf_send): Use the old API as long as possible.
(trans_caf_is_present): Generate code to check whether an allocatable
component in a derived typed coarray is allocated on a remote image.
(caf_this_image_ref): Return true, when only reffing this image.
(gfc_conv_allocated): Convert allocated queries on allocatable
components to the library API.
(conv_intrinsic_move_alloc): Adapt to new interface of
structure_alloc_comps.
* trans-openmp.c (gfc_walk_alloc_comps): Likewise.
(gfc_omp_clause_assign_op): Likewise.
(gfc_omp_clause_dtor): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Figure which mode to use when
deallocating allocatable components in derived type coarras.
* trans.c (gfc_allocate_using_lib): Renamed to
gfc_allcate_using_caf_lib.
(gfc_allocate_allocatable): Set the registration mode/type of caf-
register calls adapting to all the possible allocatable objects.
(gfc_deallocate_with_status): Add deregistration mode for allocatable
components in derived type coarrays.
(gfc_deallocate_scalar_with_status): Likewise.
* trans.h (enum gfc_coarray_type): Renamed to gfc_coarray_regtype to
avoid collision with gfc_coarray_deregtype.
From-SVN: r243021
ieee_support_halting only checked the availability of status
flags, not trapping support. On some targets the later can
only be checked at runtime: feenableexcept reports if
enabling traps failed.
So check trapping support by enabling/disabling it.
Updated the test that enabled trapping to check if it is
supported.
gcc/testsuite/
PR libgfortran/78314
* gfortran.dg/ieee/ieee_6.f90: Use ieee_support_halting.
libgfortran/
PR libgfortran/78314
* config/fpu-glibc.h (support_fpu_trap): Use feenableexcept.
From-SVN: r242505
2016-10-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/54679
* io.c (check_format): Adjust checks for FMT_L to treat a zero
width as an extension, giving warnings or error as appropriate.
Improve messages.
PR libgfortran/54679
* io/format.c (parse_format_list): Adjust checks for FMT_L to
treat a zero width as an extension, giving warnings or error
as appropriate. Improve messages.
PR fortran/54679
* gfortran.dg/fmt_l.f90: Update test.
* gfortran.dg/fmt_l0.f90: New test.
From-SVN: r241720
2016-10-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/78123
* io/transfer.c (formatted_transfer_scalar_read): Clear seen_eor
only if we have tabbed to left of current position.
* gfortran.dg/fmt_t_9.f: New test.
From-SVN: r241691
2016-10-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/77828
* io/io.h (st_parameter_dt): Reorder for readability and sanity.
* io/transfer.c (data_transfer_init): Remove TODO and enable the
runtime error message, rec= specifier not allowed in STREAM
access.
* libtool-version: Bump major version of libgfortran to 4.
* ioparm.def: Reorder dt parameters to match libgfortran.
* libgfortran.h: Swap definitions of GFC_INTERNAL_UNIT and
GFC_INTERNAL_UNIT4.
From-SVN: r241497
2016-10-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* io/transfer.c (finalize_transfer): Free format data in child
procedures. (st_read_done, st_write_done): Don't free format
hash table.
From-SVN: r241392
2016-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/48298
* io/io.h: Move size_used from dtp to unit structure. Add bool
has_size to unit structure.
* read.c (read_x): Use has_size and size_used.
* transfer.c (read_sf_internal,read_sf,read_block_form,
read_block_form4): Likewise.
(data_transfer_init): If parent, initialize the size variables.
(finalize_transfer): Set the size variable using size_used in
gfc_unit. (write_block): Delete bogus/dead code.
* gfortran.dg/dtio_17.f90: New test.
From-SVN: r241294
Improve error message, and remove a redundant check, as the same check is
done a bit earlier due to the PR 48587 patch.
2016-10-16 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/48587
* io/transfer.c (data_transfer_init): Improve error message,
remove redundant check.
Regtested on x86_64-pc-linux-gnu.
From-SVN: r241211
Currently GFortran newer reuses unit numbers allocated with NEWUNIT=,
instead having a simple counter that is decremented each time such a
unit is opened. For a long running program which repeatedly opens
files with NEWUNIT= and closes them, the counter can wrap around and
cause an abort. This patch replaces the counter with an allocator
that keeps track of which units numbers are allocated, and can reuse
them once they have been deallocated. Since operating systems tend to
limit the number of simultaneous open files for a process to a
relatively modest number, a relatively simple approach with a linear
scan through an array suffices. Though as a small optimization there
is a low water indicator keeping track of the index for which all unit
numbers below are already allocated. This linear scan also ensures
that we always allocate the smallest available unit number.
2016-10-15 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/48587
* io/io.h (get_unique_unit_number): Remove prototype.
(newunit_alloc): New prototype.
* io/open.c (st_open): Call newunit_alloc.
* io/unit.c (newunits,newunit_size,newunit_lwi): New static
variables.
(GFC_FIRST_NEWUNIT): Rename to NEWUNIT_START.
(next_available_newunit): Remove variable.
(get_unit): Call newunit_alloc, don't try to create negative
external unit.
(close_unit_1): Call newunit_free.
(close_units): Free newunits array.
(get_unique_number): Remove function.
(newunit_alloc): New function.
(newunit_free): New function.
* io/transfer.c (data_transfer_init): Check for invalid unit
number.
testsuite ChangeLog:
2016-10-15 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/48587
* gfortran.dg/negative_unit2.f90: New testcase.
From-SVN: r241199
Many POSIX systems have the bad habit of not restarting interrupted
syscalls. On these systems it's up to the user to check for an error
with errno == EINTR and restart manually. This patch does this for
libgfortran, so that GFortran users don't have to do it.
2016-10-09 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/67585
* io/io.h: TEMP_FAILURE_RETRY: Define macro if not found.
* io/unix.c (raw_read): Handle EINTR.
(raw_write): Check for return value -1.
(raw_seek): Handle EINTR.
(raw_tell): Likewise.
(raw_size): Likewise.
(raw_truncate): Likewise.
(raw_close): Likewise.
(buf_flush): Call raw_seek instead of lseek.
(buf_read): Likewise.
(buf_write): Likewise.
(fd_to_stream): Handle EINTR.
(tempfile_open): Likewise.
(regular_file2): Likewise.
(compare_file_filename): Likewise.
(find_file): Likewise.
(inquire_sequential): Likewise.
(inquire_direct): Likewise.
(inquire_formatted): Likewise.
From-SVN: r240902
gcc/testsuite/ChangeLog:
2016-10-01 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/77663
* gfortran.dg/coarray_send_by_ref_1.f08: New test.
libgfortran/ChangeLog:
2016-10-01 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/77663
* caf/single.c (caf_internal_error): Fix not terminating va-list.
(_gfortran_caf_register): Free memory also when other allocs failed.
(_gfortran_caf_get_by_ref): Fixed style.
(send_by_ref): Token is now stored at the correct position preventing
inaccessible tokens, memory loss and possibly crashes.
From-SVN: r240695
2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/48298
* io/inquire.c (inquire_via_unit): Adjust error check for the
two possible internal unit KINDs.
* io/io.h: Adjust defines for is_internal_unit and
is_char4_unit. (gfc_unit): Add internal unit data to structure.
(get_internal_unit): Change declaration to set_internal_unit.
(free_internal_unit): Change name to stash_internal_unit_number.
(get_unique_unit_number): Adjust parameter argument.
Define IOPARM_DT_HAS_UDTIO. (gfc_saved_unit): New structure.
* io/list_read.c (next_char_internal): Use is_char4_unit.
* io/open.c (st_open): Adjust call to get_unique_unit_number.
* io/transfer.c (write_block): Use is_char4_unit.
(data_transfer_init): Update check for unit numbers.
(st_read_done): Free the various allocated memories used for the
internal units and stash the negative unit number and pointer to unit
structure to allow reuse. (st_write_done): Likewise stash the freed
unit.
* io/unit.c: Create a fixed size buffer of 16 gfc_saved_unit's to use
as a stack to save newunit unit numbers and unit structure for reuse.
(get_external_unit): Change name to get_gfc_unit to better
reflect what it does. (find_unit): Change call to get_gfc_unit.
(find_or_create_unit): Likewise. (get_internal_unit): Change
name to set_internal_unit. Move internal unit from the dtp
structure to the gfc_unit structure so that it can be passed to
child I/O statements through the UNIT.
(free_internal_unit): Change name to stash_internal_unit_number.
Push the common.unit number onto the newunit stack, saving it
for possible reuse later. (get_unit): Set the internal unit
KIND. Use get_unique_unit_number to get a negative unit number
for the internal unit. Use get_gfc_unit to get the unit structure
and use set_internal_unit to initialize it.
(init_units): Initialize the newunit stack.
(get_unique_unit_number): Check the stack for an available unit
number and use it. If none there get the next most negative
number. (close_units): Free any unit structures pointed to from the save
stack.
2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/48298
* gfortran.h (gfc_dt): Add *udtio.
* ioparm.def: Add bit IOPARM_dt_f2003 to align with library use of bit
25. Add IOPARM_dt_dtio bit to common flags.
* resolve.c (resolve_transfer): Set dt->udtio to expression.
* io.c (gfc_match_inquire): Adjust error message for internal
unit KIND.
* libgfortran.h: Adjust defines for GFC_INTERNAL_UNIT4,
GFC_INTERNAL_UNIT, and GFC_INVALID_UNIT.
* trans-io.c (build_dt): Set common_unit to reflect the KIND of
the internal unit. Set mask bit for presence of dt->udtio.
2016-09-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/48298
* gfortran.dg/negative_unit_check.f90: Update test.
* gfortran.dg/dtio_14.f90: New test.
From-SVN: r240456
2016-09-21 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/random.c (getosrandom): Use rand_s() on
MinGW-w64. Fix bounds overflow in fallback code.
From-SVN: r240309
libgfortran/ChangeLog:
2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org>
* caf/libcaf.h: Add caf_reference_type.
* caf/mpi.c: Adapted signature of caf_register().
* caf/single.c (struct caf_single_token): Added to keep the pointer
to the memory registered and array descriptor.
(caf_internal_error): Added convenience interface.
(_gfortran_caf_register): Adapted to work with caf_single_token and
return memory in the array descriptor.
(_gfortran_caf_deregister): Same.
(assign_char1_from_char4): Fixed style.
(convert_type): Fixed incorrect conversion.
(_gfortran_caf_get): Adapted to work with caf_single_token.
(_gfortran_caf_send): Same.
(_gfortran_caf_sendget): Same.
(copy_data): Added to stop repeating it in all _by_ref functions.
(get_for_ref): Recursive getting of coarray data using a chain of
references.
(_gfortran_caf_get_by_ref): Driver for computing the memory needed for
the get and checking properties of the operation.
(send_by_ref): Same as get_for_ref but for sending data.
(_gfortran_caf_send_by_ref): Same like caf_get_by_ref but for sending.
(_gfortran_caf_sendget_by_ref): Uses get_by_ref and send_by_ref to
implement sendget for reference chains.
(_gfortran_caf_atomic_define): Adapted to work with caf_single_token.
(_gfortran_caf_atomic_ref): Likewise.
(_gfortran_caf_atomic_cas): Likewise.
(_gfortran_caf_atomic_op): Likewise.
(_gfortran_caf_event_post): Likewise.
(_gfortran_caf_event_wait): Likewise.
(_gfortran_caf_event_query): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
gcc/testsuite/ChangeLog:
2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray/alloc_comp_4.f90: New test.
* gfortran.dg/coarray_38.f90:
* gfortran.dg/coarray_alloc_comp_1.f08: New test.
* gfortran.dg/coarray_alloc_comp_2.f08: New test.
* gfortran.dg/coarray_allocate_7.f08: New test.
* gfortran.dg/coarray_allocate_8.f08: New test.
* gfortran.dg/coarray_allocate_9.f08: New test.
* gfortran.dg/coarray_lib_alloc_1.f90: Adapted scan-tree-dumps to expect
new caf_register.
* gfortran.dg/coarray_lib_alloc_2.f90: Same.
* gfortran.dg/coarray_lib_alloc_3.f90: Same.
* gfortran.dg/coarray_lib_comm_1.f90: Adapted scan-tree-dumps to expect
get_by_refs.
* gfortran.dg/coarray_lib_token_3.f90: Same as for coarray_lib_alloc2.
* gfortran.dg/coarray_lock_7.f90: Same.
* gfortran.dg/coarray_poly_5.f90: Same.
* gfortran.dg/coarray_poly_6.f90: Same.
* gfortran.dg/coarray_poly_7.f90: Same.
* gfortran.dg/coarray_poly_8.f90: Same.
* gfortran.dg/coindexed_1.f90: Changed errors expected.
gcc/fortran/ChangeLog:
2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org>
* expr.c (gfc_check_assign): Added flag to control whether datatype
conversion is allowed.
* gfortran.h: Added caf-token-tree to gfc_component. Changed
prototypes mostly to add whether datatype conversion is allowed.
* gfortran.texi: Added documentation for the caf_reference_t and the
caf_*_by_ref function.
* primary.c (caf_variable_attr): Similar to gfc_variable_attr but
focused on the needs of coarrays.
(gfc_caf_attr): Same.
* resolve.c (resolve_ordinary_assign): Set the conversion allowed
flag when not in a coarray.
* trans-array.c (gfc_array_init_size): Moved setting of array
descriptor's datatype before the alloc, because caf_register needs it.
(gfc_array_allocate): Changed notion of whether an array is a coarray.
(gfc_array_deallocate): Same.
(gfc_alloc_allocatable_for_assignment): Added setting of coarray's
array descriptor datatype before the register. And using deregister/
register to mimmick a realloc for coarrays.
* trans-decl.c (gfc_build_builtin_function_decls): Corrected signatures
of old caf-functions and added signature definitions of the _by_ref
ones.
(generate_coarray_sym_init): Adapted to new caf_register signature.
* trans-expr.c (gfc_conv_scalar_to_descriptor): Make sure a constant
is translated to an lvalue expression before use in an array
descriptor.
(gfc_get_ultimate_alloc_ptr_comps_caf_token): New function. Get the
last allocatable component's coarray token.
(gfc_get_tree_for_caf_expr): For top-level object get the coarray
token and check for unsupported features.
(gfc_get_caf_token_offset): Getting the offset might procude new
statements, which now are stored in the pre and post of the current se.
(gfc_caf_get_image_index): For this image return a call to
caf_this_image.
(expr_may_alias_variables): Check that the result is set for testing
its properties.
(alloc_scalar_allocatable_for_assignment): Added auto allocation of
coarray components.
(gfc_trans_assignment_1): Rewrite an assign to a coarray object to
be a sendget.
* trans-intrinsic.c (conv_caf_vector_subscript_elem): Corrected
wrong comment.
(compute_component_offset): Compute the correct offset a structure
member.
(conv_expr_ref_to_caf_ref): Convert to a chain of refs into
caf_references.
(gfc_conv_intrinsic_caf_get): Call caf_get_by_ref instead of caf_get.
(conv_caf_send): Call caf_*_by_ref for coarrays that need
reallocation.
(gfc_conv_intrinsic_function): Adapted to new signuature of the caf
drivers.
(conv_intrinsic_atomic_op): Add pre and post statements correctly.
(conv_intrinsic_atomic_ref): Same.
(conv_intrinsic_atomic_cas): Same.
(conv_intrinsic_event_query): Same.
* trans-stmt.c (gfc_trans_lock_unlock): Same.
(gfc_trans_event_post_wait): Same.
(gfc_trans_allocate): Support allocation of allocatable coarrays.
(gfc_trans_deallocate): And there deallocation.
* trans-types.c (gfc_typenode_for_spec): Added flag to control whether
a component is part of coarray. When so, then add space to store a
coarray token.
(gfc_build_array_type): Same.
(gfc_get_array_descriptor_base): Same.
(gfc_get_array_type_bounds): Same.
(gfc_sym_type): Same.
(gfc_get_derived_type): Same.
(gfc_get_caf_reference_type): Declare the caf_reference_type.
* trans-types.h: Prototype changes only.
* trans.c (gfc_allocate_using_lib): Use the updated caf_register
signature.
(gfc_allocate_allocatable): Same.
(gfc_deallocate_with_status): Same.
* trans.h: Defined the runtime types for caf_reference_t and the enums.
From-SVN: r240231
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77507
* intrinsic.c (add_functions): Use correct keyword.
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77507
* ieee/ieee_arithmetic.F90 (IEEE_VALUE_4,IEEE_VALUE_8,IEEE_VALULE_10,
IEEE_VALUE_16): Use correct keyword.
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77507
* gfortran.dg/pr77507.f90: New test.
From-SVN: r240050
2016-09-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/77393
* io/write_float.def (build_float_string): Recognize when the
result will not fit in the user provided, star fill, and exit
early.
* gfortran.dg/fmt_f0_2.f90: Update test.
* gfortran.dg/fmt_f0_3.f90: New test.
From-SVN: r240018
2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/77393
* io/write.c (kind_from_size): New function to calculate required buffer
size based on kind type. (select_buffer, select_string): Use new
function. (write_float_0, write_real, write_real_g0, write_complex):
Adjust calls to pass parameters needed by new function.
From-SVN: r239900
2016-08-31 Paul Thomas <pault@gcc.gnu.org>
Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/48298
* decl.c (access_attr_decl): Include case INTERFACE_DTIO as
appropriate.
* gfortran.h : Add INTRINSIC_FORMATTED and
INTRINSIC_UNFORMATTED to gfc_intrinsic_op. Add INTERFACE_DTIO
to interface type. Add new enum 'dtio_codes'. Add bitfield
'has_dtio_procs' to symbol_attr. Add prototypes
'gfc_check_dtio_interfaces' and 'gfc_find_specific_dtio_proc'.
* interface.c (dtio_op): New function.
(gfc_match_generic_spec): Match generic DTIO interfaces.
(gfc_match_interface): Treat DTIO interfaces in the same way as
(gfc_current_interface_head): Add INTERFACE_DTIO appropriately.
(check_dtio_arg_TKR_intent): New function.
(check_dtio_interface1): New function.
(gfc_check_dtio_interfaces): New function.
(gfc_find_specific_dtio_proc): New function.
* io.c : Add FMT_DT to format_token.
(format_lex): Handle DTIO formatting.
* match.c (gfc_op2string): Add DTIO operators.
* resolve.c (derived_inaccessible): Ignore pointer components
to enclosing derived type.
(resolve_transfer): Resolve transfers that involve DTIO.
procedures. Find the specific subroutine for the transfer and
use its existence to over-ride some of the constraints on
derived types. If the transfer is recursive, require that the
subroutine be so qualified.
(dtio_procs_present): New function.
(resolve_fl_namelist): Remove inhibition of polymorphic objects
in namelists if DTIO read and write subroutines exist. Likewise
for derived types.
(resolve_types): Invoke 'gfc_verify_dtio_procedures'.
* symbol.c : Set 'dtio_procs' using 'minit'.
* trans-decl.c (gfc_finish_var_decl): If a derived-type/class
object is associated with DTIO procedures, make it TREE_STATIC.
* trans-expr.c (gfc_get_vptr_from_expr): If the expression
drills down to a PARM_DECL, extract the vptr correctly.
(gfc_conv_derived_to_class): Check 'info' in the test for
'useflags'. If the se expression exists and is a pointer, use
it as the class _data.
* trans-io.c : Add IOCALL_X_DERIVED to iocall and the function
prototype. Likewise for IOCALL_SET_NML_DTIO_VAL.
(set_parameter_tree): Renamed from 'set_parameter_const', now
returns void and has new tree argument. Calls modified to match
new interface.
(transfer_namelist_element): Transfer DTIO procedure pointer
and vpointer using the new function IOCALL_SET_NML_DTIO_VAL.
(get_dtio_proc): New function.
(transfer_expr): Add new argument for the vptr field of class
objects. Add the code to call the specific DTIO proc, convert
derived types to class and call IOCALL_X_DERIVED.
(trans_transfer): Add BT_CLASS to structures for treatment by
the scalarizer. Obtain the vptr for the dynamic type, both for
scalar and array transfer.
2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
PR libgfortran/48298
* gfortran.map : Flag _st_set_nml_dtio_var and
_gfortran_transfer_derived.
* io/format.c (format_lex): Detect DTIO formatting.
(parse_format_list): Parse the DTIO format.
(next_format): Include FMT_DT.
* io/format.h : Likewise. Add structure 'udf' to structure
'fnode' to carry the IOTYPE string and the 'vlist'.
* io/io.h : Add prototypes for the two types of DTIO subroutine
and a typedef for gfc_class. Also, add to 'namelist_type'
fields for the pointer to the DTIO procedure and the vtable.
Add fields to struct st_parameter_dt for pointers to the two
types of DTIO subroutine. Add to gfc_unit DTIO specific fields.
(internal_proto): Add prototype for 'read_user_defined' and
'write_user_defined'.
* io/list_read.c (check_buffers): Use the 'current_unit' field.
(unget_char): Likewise.
(eat_spaces): Likewise.
(list_formatted_read_scalar): For case BT_CLASS, call the DTIO
procedure.
(nml_get_obj_data): Likewise when DTIO procedure is present,.
* io/transfer.c : Export prototypes for 'transfer_derived' and
'transfer_derived_write'.
(unformatted_read): For case BT_CLASS, call the DTIO procedure.
(unformatted_write): Likewise.
(formatted_transfer_scalar_read): Likewise.
(formatted_transfer_scalar_write: Likewise.
(transfer_derived): New function.
(data_transfer_init): Set last_char if no child_dtio.
(finalize_transfer): Return if child_dtio set.
(st_write_done): Add condition for child_dtio not set.
Add extra arguments for st_set_nml_var prototype.
(set_nml_var): New function that contains the contents of the
old version of st_set_nml_var. Also sets the 'dtio_sub' and
'vtable' fields of the 'nml' structure.
(st_set_nml_var): Now just calls set_nml_var with 'dtio_sub'
and 'vtable' NULL.
(st_set_nml_dtio_var): New function that calls set_nml_var.
* io/unit.c (get_external_unit): If the found unit child_dtio
is non zero, don't do any mutex locking/unlocking. Just
return the unit.
* io/unix.c (tempfile_open): Revert to C style comment.
* io/write.c (list_formatted_write_scalar): Do the DTIO call.
(nml_write_obj): Add BT_CLASS and do the DTIO call.
2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/48298
* gfortran.dg/dtio_1.f90: New test.
* gfortran.dg/dtio_2.f90: New test.
* gfortran.dg/dtio_3.f90: New test.
* gfortran.dg/dtio_4.f90: New test.
* gfortran.dg/dtio_5.f90: New test.
* gfortran.dg/dtio_6.f90: New test.
* gfortran.dg/dtio_7.f90: New test.
* gfortran.dg/dtio_8.f90: New test.
* gfortran.dg/dtio_9.f90: New test.
* gfortran.dg/dtio_10.f90: New test.
From-SVN: r239880