Fortran 2018 adds a new QUIET specifier for the STOP and ERROR STOP
statements, in order to suppress the printing of signaling FP
exceptions and the stop code. This patch adds the necessary library
changes, but for now the new specifier is not parsed and the frontend
unconditionally adds a false value for the new argument.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* trans-decl.c (gfc_build_builtin_function_decls): Add bool
argument to stop and error stop decls.
* trans-stmt.c (gfc_trans_stop): Add false value to argument
lists.
libgfortran/ChangeLog:
2018-02-23 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/84519
* caf/libcaf.h (_gfortran_caf_stop_numeric): Add bool argument.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
* caf/mpi.c (_gfortran_caf_error_stop_str): Handle new argument.
(_gfortran_caf_error_stop): Likewise.
* caf/single.c (_gfortran_caf_stop_numeric): Likewise.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
* libgfortran.h (stop_string): Add bool argument.
* runtime/pause.c (do_pause): Add false argument.
* runtime/stop.c (stop_numeric): Handle new argument.
(stop_string): Likewise.
(error_stop_string): Likewise.
(error_stop_numeric): Likewise.
From-SVN: r257928
Following the change to use size_t for Fortran character lengths (PR
78534), this patch modifies the Coarray ABI in a similar way. The
single-image implementation that is included in libgfortran is
updated, but this needs corresponding work in the OpenCoarray library
as well for multi-image support. I also fixed the types for the STOP
and ERROR STOP implementation in libgfortran, as the calling of them
is somewhat intertwined with the calling of the corresponding CAF
functions. I'll send the OpenCoarray changes as a separate pull
request to the OpenCoarrays repository.
Regtested on x86_64-pc-linux-gnu.
gcc/fortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
* gfortran.texi: Update Coarray API description.
* trans-decl.c (gfc_build_builtin_function_decls): Use size_t for
character lengths, int for exit codes.
(generate_coarray_sym_init): Use size_t for character length.
* trans-intrinsic.c (conv_co_collective): Likewise.
* trans-stmt.c (gfc_trans_lock_unlock): Likewise.
(gfc_trans_event_post_wait): Likewise.
(gfc_trans_sync): Likewise.
(gfc_trans_stop): Use size_t for character lengths, int for exit
codes.
libgfortran/ChangeLog:
2018-02-22 Janne Blomqvist <jb@gcc.gnu.org>
* libgfortran.h (stop_string): Use size_t for character length.
* runtime/stop.c (stop_string): Likewise.
(error_stop_string): Likewise.
(stop_numeric): Use int for exit code.
(error_stop_numeric): Likewise.
* caf/libcaf.h: Remove stdint.h include.
(_gfortran_caf_register): Use size_t for character length.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_memory): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_stop_numeric): Use int for exit code.
(_gfortran_caf_stop_str): Use size_t for character length.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Use int for exit code.
(_gfortran_caf_co_broadcast): Use size_t for character length.
(_gfortran_caf_co_sum): Likewise.
(_gfortran_caf_co_min): Likewise.
(_gfortran_caf_co_max): Likewise.
(_gfortran_caf_co_reduce): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
(_gfortran_caf_event_post): Likewise.
(_gfortran_caf_event_wait): Likewise.
* caf/mpi.c (_gfortran_caf_register): Update implementation to
match prototype.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
* caf/single.c (caf_internal_error): Likewise.
(_gfortran_caf_register): Likewise.
(_gfortran_caf_deregister): Likewise.
(_gfortran_caf_sync_all): Likewise.
(_gfortran_caf_sync_memory): Likewise.
(_gfortran_caf_sync_images): Likewise.
(_gfortran_caf_stop_numeric): Likewise.
(_gfortran_caf_stop_str): Likewise.
(_gfortran_caf_error_stop_str): Likewise.
(_gfortran_caf_error_stop): Likewise.
(_gfortran_caf_co_broadcast): Likewise.
(_gfortran_caf_co_sum): Likewise.
(_gfortran_caf_co_min): Likewise.
(_gfortran_caf_co_max): Likewise.
(_gfortran_caf_co_reduce): Likewise.
(_gfortran_caf_event_post): Likewise.
(_gfortran_caf_event_wait): Likewise.
(_gfortran_caf_lock): Likewise.
(_gfortran_caf_unlock): Likewise.
From-SVN: r257894
gcc/fortran/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.texi: Document additional src/dst_type. Fix some typos.
* trans-decl.c (gfc_build_builtin_function_decls): Declare the new
argument of _caf_*_by_ref () with * e { get, send, sendget }.
* trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Add the type of the
data referenced when generating a call to caf_get_by_ref ().
(conv_caf_send): Same but for caf_send_by_ref () and
caf_sendget_by_ref ().
gcc/testsuite/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray_alloc_comp_6.f08: New test.
* gfortran.dg/coarray_alloc_comp_7.f08: New test.
* gfortran.dg/coarray_alloc_comp_8.f08: New test.
libgfortran/ChangeLog:
2018-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
* caf/libcaf.h: Add type parameters to the caf_*_by_ref prototypes.
* caf/single.c (get_for_ref): Simplifications and now respecting
the type argument.
(_gfortran_caf_get_by_ref): Added source type handing to get_for_ref().
(send_by_ref): Simplifications and respecting the dst_type now.
(_gfortran_caf_send_by_ref): Added destination type hand over to
send_by_ref().
(_gfortran_caf_sendget_by_ref): Added general support and fixed stack
corruption. The function is now really usable.
From-SVN: r257813
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* array.c (gfc_match_array_ref): If standard earlier than F2008
it is an error if the reference dimension is greater than 7.
libgfortran.h : Increase GFC_MAX_DIMENSIONS to 15. Change the
dtype masks and shifts accordingly.
* trans-array.c (gfc_conv_descriptor_dtype): Use the dtype
type node to check the field.
(gfc_conv_descriptor_dtype): Access the rank field of dtype.
(duplicate_allocatable_coarray): Access the rank field of the
dtype descriptor rather than the dtype itself.
* trans-expr.c (get_scalar_to_descriptor_type): Store the type
of 'scalar' on entry and use its TREE_TYPE if it is ARRAY_TYPE
(ie. a character).
(gfc_conv_procedure_call): Pass TREE_OPERAND (tmp,0) to
get_scalar_to_descriptor_type if the actual expression is a
constant.
(gfc_trans_structure_assign): Assign the rank directly to the
dtype rank field.
* trans-intrinsic.c (gfc_conv_intrinsic_rank): Cast the result
to default integer kind.
(gfc_conv_intrinsic_sizeof): Obtain the element size from the
'elem_len' field of the dtype.
* trans-io.c (gfc_build_io_library_fndecls): Replace
gfc_int4_type_node with dtype_type_node where necessary.
(transfer_namelist_element): Use gfc_get_dtype_rank_type for
scalars.
* trans-types.c : Provide 'get_dtype_type_node' to acces the
dtype_type_node and, if necessary, build it.
The maximum size of an array element is now determined by the
maximum value of size_t.
Update the description of the array descriptor, including the
type def for the dtype_type.
(gfc_get_dtype_rank_type): Build a constructor for the dtype.
Distinguish RECORD_TYPEs that are BT_DERIVED or BT_CLASS.
(gfc_get_array_descriptor_base): Change the type of the dtype
field to dtype_type_node.
(gfc_get_array_descr_info): Get the offset to the rank field of
the dtype.
* trans-types.h : Add a prototype for 'get_dtype_type_node ()'.
* trans.h : Define the indices of the dtype fields.
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* gfortran.dg/coarray_18.f90: Allow dimension 15 for F2008.
* gfortran.dg/coarray_lib_this_image_2.f90: Change 'array1' to
'array01' in the tree dump comparison.
* gfortran.dg/coarray_lib_token_4.f90: Likewise.
* gfortran.dg/inline_sum_1.f90: Similar - allow two digits.
* gfortran.dg/rank_1.f90: Allow dimension 15 for F2008.
2018-25-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37577
* caf/single.c (_gfortran_caf_failed_images): Access the 'type'
and 'elem_len' fields of the dtype instead of the shifts.
(_gfortran_caf_stopped_images): Likewise.
* intrinsics/associated.c (associated): Compare the 'type' and
'elem_len' fields instead of the dtype.
* caf/date_and_time.c : Access the dtype fields rather using
shifts and masks.
* io/transfer.c (transfer_array ): Comment on item count.
(set_nml_var,st_set_nml_var): Change dtype type and use fields.
(st_set_nml_dtio_var): Likewise.
* libgfortran.h : Change definition of GFC_ARRAY_DESCRIPTOR and
add a typedef for the dtype_type. Change the GFC_DTYPE_* macros
to access the dtype fields.
From-SVN: r257065
gcc/fortran/ChangeLog:
2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (positive_check): Add new function checking constant for
being greater then zero.
(gfc_check_image_status): Add checking of image_status arguments.
(gfc_check_failed_or_stopped_images): Same but for failed_- and
stopped_images function.
* dump-parse-tree.c (show_code_node): Added output of FAIL IMAGE.
* gfortran.h (enum gfc_statement): Added FAIL_IMAGE_ST.
(enum gfc_isym_id): Added new intrinsic symbols.
(enum gfc_exec_op): Added EXEC_FAIL_IMAGE.
* gfortran.texi: Added description for the new API functions. Updated
coverage of gfortran of TS18508.
* intrinsic.c (add_functions): Added symbols to resolve new intrinsic
functions.
* intrinsic.h: Added prototypes.
* iresolve.c (gfc_resolve_failed_images): Resolve the failed_images
intrinsic.
(gfc_resolve_image_status): Same for image_status.
(gfc_resolve_stopped_images): Same for stopped_images.
* libgfortran.h: Added prototypes.
* match.c (gfc_match_if): Added matching of FAIL IMAGE statement.
(gfc_match_fail_image): Match a FAIL IMAGE statement.
* match.h: Added prototype.
* parse.c (decode_statement): Added matching for FAIL IMAGE.
(next_statement): Same.
(gfc_ascii_statement): Same.
* resolve.c: Same.
* simplify.c (gfc_simplify_failed_or_stopped_images): For COARRAY=
single a constant result can be returne.d
(gfc_simplify_image_status): For COARRAY=single the result is constant.
* st.c (gfc_free_statement): Added FAIL_IMAGE handling.
* trans-decl.c (gfc_build_builtin_function_decls): Added decls of the
new intrinsics.
* trans-expr.c (gfc_conv_procedure_call): This is first time all
arguments of a function are optional, which is now handled here
correctly.
* trans-intrinsic.c (conv_intrinsic_image_status): Translate
image_status.
(gfc_conv_intrinsic_function): Add support for image_status.
(gfc_is_intrinsic_libcall): Add support for the remaining new
intrinsics.
* trans-stmt.c (gfc_trans_fail_image): Trans a fail image.
* trans-stmt.h: Add the prototype for the above.
* trans.c (trans_code): Dispatch for fail_image.
* trans.h: Add the trees for the new intrinsics.
libgfortran/ChangeLog:
2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* caf/libcaf.h: Added prototypes and stat codes for failed and stopped
images.
* caf/single.c (void _gfortran_caf_fail_image): Add the routine.
(int _gfortran_caf_image_status): Same.
(_gfortran_caf_failed_images): Same.
(_gfortran_caf_stopped_images): Same.
gcc/testsuite/ChangeLog:
2017-03-05 Andre Vehreschild <vehre@gcc.gnu.org>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/fail_image_1.f08: New test.
* gfortran.dg/coarray/fail_image_2.f08: New test.
* gfortran.dg/coarray/failed_images_1.f08: New test.
* gfortran.dg/coarray/failed_images_2.f08: New test.
* gfortran.dg/coarray/image_status_1.f08: New test.
* gfortran.dg/coarray/image_status_2.f08: New test.
* gfortran.dg/coarray/stopped_images_1.f08: New test.
* gfortran.dg/coarray/stopped_images_2.f08: New test.
* gfortran.dg/coarray_fail_st.f90: New test.
* gfortran.dg/coarray_failed_images_1.f08: New test.
* gfortran.dg/coarray_image_status_1.f08: New test.
* gfortran.dg/coarray_stopped_images_1.f08: New test.
From-SVN: r245900
gcc/testsuite/ChangeLog:
2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/70696
* gfortran.dg/coarray/event_3.f08: New test.
gcc/fortran/ChangeLog:
2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/70696
* trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl
is valid before accessing it.
libgfortran/ChangeLog:
2017-01-13 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/70696
* caf/single.c (_gfortran_caf_register): Allocate enough memory for
the event counter.
From-SVN: r244407
gcc/fortran/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78781
PR fortran/78935
* expr.c (gfc_check_pointer_assign): Return the same error message for
rewritten coarray pointer assignments like for plain ones.
* gfortran.h: Change prototype.
* primary.c (caf_variable_attr): Set attributes used ones only only
ones. Add setting of pointer_comp attribute.
(gfc_caf_attr): Add setting of pointer_comp attribute.
* trans-array.c (gfc_array_allocate): Add flag that the component to
allocate is not an ultimate coarray component. Add allocation of
pointer arrays.
(structure_alloc_comps): Extend nullify to treat pointer components in
coarrays correctly. Restructure nullify to remove redundant code.
(gfc_nullify_alloc_comp): Allow setting caf_mode flags.
* trans-array.h: Change prototype of gfc_nullify_alloc_comp ().
* trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for
derived type coarrays with pointer components.
* trans-expr.c (gfc_trans_structure_assign): Also treat pointer
components.
(trans_caf_token_assign): Handle assignment of token of scalar pointer
components.
(gfc_trans_pointer_assignment): Call above routine.
* trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer
components.
(gfc_conv_intrinsic_caf_get): Likewise.
(conv_caf_send): Likewise.
* trans-stmt.c (gfc_trans_allocate): After allocating a derived type in
a coarray pre-register the tokens.
(gfc_trans_deallocate): Simply determining the coarray type (scalar or
array) and deregistering it correctly.
* trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the
actual codim to allow lookup of array types in the cache.
(gfc_build_array_type): Likewise.
(gfc_get_array_descriptor_base): Likewise.
(gfc_get_array_type_bounds): Likewise.
(gfc_get_derived_type): Likewise.
* trans-types.h: Likewise.
* trans.c (gfc_deallocate_with_status): Enable deregistering of all kind
of coarray components.
(gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode
instead of caf_deregister.
libgfortran/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/78781
PR fortran/78935
* caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar
destination components.
gcc/testsuite/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray/ptr_comp_1.f08: New test.
* gfortran.dg/coarray/ptr_comp_2.f08: New test.
* gfortran.dg/coarray/ptr_comp_3.f08: New test.
* gfortran.dg/coarray/ptr_comp_4.f08: New test.
* gfortran.dg/coarray_ptr_comp_1.f08: New test.
* gfortran.dg/coarray_ptr_comp_2.f08: New test.
* gfortran.dg/coarray_ptr_comp_3.f08: New test.
From-SVN: r244196
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
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
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
libgfortran/ChangeLog:
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
* caf/libcaf.h: Add parameter stat to caf_get() and
caf_send()'s function prototypes.
* caf/single.c (_gfortran_caf_get): Implement reporting
error using stat instead of abort().
(_gfortran_caf_send): Same.
(_gfortran_caf_sendget): Use NULL for stat when calling
caf_send().
gcc/testsuite/ChangeLog:
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray_stat_2.f90: New test.
From-SVN: r238636
Based on GCC trunk r220892, for nvptx-none:
=== gfortran Summary ===
# of expected passes [-31320-]{+32117+}
# of unexpected failures [-7222-]{+6821+}
# of expected failures 78
# of unresolved testcases [-6441-]{+6158+}
# of untested testcases [-432-]{+391+}
# of unsupported tests 639
libgfortran/
* caf/single.c (caf_runtime_error): Revert 2014-11-28 changes.
* runtime/minimal.c (STRERR_MAXSZ): Don't define.
(runtime_error_at, sys_abort): Bring more in line with the
non-LIBGFOR_MINIMAL code.
(runtime_warning_at, internal_error): New functions.
From-SVN: r221363
2014-05-11 Tobias Burnus <burnus@net-b.de>
* trans-intrinsic.c (gfc_build_builtin_function_decls):
Change type of second argument to int.
2014-05-11 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (_gfortran_caf_num_images): Change type of
second argument to int.
* caf/mpi.c (_gfortran_caf_num_images): Ditto.
* caf/single.c (_gfortran_caf_num_images): Ditto.
From-SVN: r210311
2011-07-09 Tobias Burnus <burnus@net-b.de>
Daniel Carrera <dcarrera@gmail.com>
* caf/mpi.c (runtime_error): New function.
(_gfortran_caf_register): Use it.
(_gfortran_caf_sync_all): Use it, add STAT_STOPPED_IMAGE
as possible status value.
(_gfortran_caf_sync_images): Ditto.
Co-Authored-By: Daniel Carrera <dcarrera@gmail.com>
From-SVN: r176080
2011-06-17 Daniel Carrera <dcarrera@gmail.com>
* caf/single.c (_gfortran_caf_register): Store the address
of all static coarrays in a linked list.
(_gfortran_caf_finalize): Free memory of staic coarrays.
* caf/mpi.c (_gfortran_caf_register): Store the address
of all static coarrays in a linked list. Initialize MPI
if necessary.
(_gfortran_caf_finalize): Free memory of staic coarrays.
(_gfortran_caf_init): Check if MPI is already initialized
before initializing again.
* caf/libcaf.h: Add a type to caf_register_t to distinguish
static coarrays and add the type caf_static_t to make the
linked list of static coarrays.
From-SVN: r175124
gcc/fortran/
2011-06-10 Daniel Carrera <dcarrera@gmail.com>
* trans-decl.c (gfc_build_builtin_function_decls):
Updated declaration of caf_sync_all and caf_sync_images.
* trans-stmt.c (gfc_trans_sync): Function
can now handle a "stat" variable that has an integer type
different from integer_type_node.
libgfortran/
2011-06-10 Daniel Carrera <dcarrera@gmail.com>
* caf/mpi.c (_gfortran_caf_sync_all,
_gfortran_caf_sync_images): Functions have void return type
and move status into parameter list.
* caf/single.c (_gfortran_caf_sync_all,
_gfortran_caf_sync_images): Functions have void return type
and move status into parameter list.
* caf/libcaf.h (_gfortran_caf_sync_all,
_gfortran_caf_sync_images): Functions have void return type
and move status into parameter list.
gcc/testsuite/
2011-06-10 Daniel Carrera <dcarrera@gmail.com>
* gfortran.dg/coarray/sync_1.f90: New test for
"SYNC ALL", "SYNC MEMORY" and "SYNC IMAGES".
From-SVN: r174896
2011-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* caf/mpi.c (_gfortran_caf_init, _gfortran_caf_finalize):
Add global variable caf_mpi_initialized and use it for when
finalizing.
From-SVN: r172059