Commit Graph

30 Commits

Author SHA1 Message Date
Nobody ba4cc64fdf libgfortran (liblfortran) with MCST patches 2022-08-11 23:12:27 +03:00
Andre Vehreschild ef78bc3c0b check.c (positive_check): Add new function checking constant for being greater then zero.
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
2017-03-05 12:35:47 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Andre Vehreschild ba85c8c3fc libcaf.h: Add new action types for (de-)registration of allocatable components in derived...
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
2016-11-30 14:27:49 +01:00
Andre Vehreschild 3c9f5092c6 libcaf.h: Add caf_reference_type.
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-19 15:45:40 +02:00
Andre Vehreschild 9fe9a3a780 libcaf.h: Add parameter stat to caf_get() and caf_send()'s function prototypes.
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
2016-07-22 11:58:50 +02:00
Alessandro Fanfarillo 0daa7ed944 STOP managed by external library when coarrays are used
From-SVN: r234502
2016-03-28 03:05:01 -06:00
Jakub Jelinek 818ab71a41 Update copyright years.
From-SVN: r232055
2016-01-04 15:30:50 +01:00
Tobias Burnus 5df445a2a5 check.c (gfc_check_event_query): New function.
2015-12-02  Tobias Burnus  <burnus@net-b.de>
	    Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

	* check.c (gfc_check_event_query): New function.
	* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
	EXEC_EVENT_WAIT.
	* expr.c (gfc_check_vardef_context): New check for event variables
	definition.
	* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
	(struct symbol_attribute): New field.
	(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
	* gfortran.texi: Document about new events functions and minor
	changes.
	* interface.c (compare_parameter): New check.
	(gfc_procedure_use): New check for explicit procedure interface.
	(add_subroutines): Add event_query.
	* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
	New prototypes.
	* iresolve.c (gfc_resolve_event_query): New function.
	* iso-fortran-env.def (event_type): New type.
	* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
	New functions.
	(gfc_match_name): New event post and event wait.
	* match.h (gfc_match_event_post,gfc_match_event_wait):
	New prototypes.
	* module.c (ab_attribute): Add AB_EVENT_COMP.
	(attr_bits): Likewise.
	(mio_symbol_attribute): Handle event_comp attribute.
	* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
	(parse_derived): Check for event_type components.
	* resolve.c (resolve_allocate_expr): Check for event variable def.
	(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
	includes logic for locks and events.
	(gfc_resolve_code): Call it.
	(gfc_resolve_symbol): New check for event variable to be a corray.
	* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
	EXEC_EVENT_WAIT.
	* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
	gfor_fndecl_caf_event_query): New global variables.
	(generate_coarray_sym_init): Checking for event_type.
	(gfc_conv_procedure_call): Check for C bind attribute.
	* trans-intrinsic.c (conv_intrinsic_event_query): New function.
	(conv_intrinsic_move_alloc): Call it.
	* trans-stmt.c (gfc_trans_lock_unlock): Passing address
	of actual argument.
	(gfc_trans_sync): Likewise.
	(gfc_trans_event_post_wait): New function.
	* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
	* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
	* trans.c (gfc_allocate_using_lib): New argument and logic for events.
	(gfc_allocate_allocatable): Passing new argument.
	(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
	* trans.h (gfc_coarray_type): New elements.
	(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
	gfor_fndecl_caf_event_query): Declare them.

2015-12-02  Tobias Burnus  <burnus@net-b.de>
	    Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

	* gfortran.dg/coarray/event_1.f90: New.
	* gfortran.dg/coarray/event_2.f90: New.

Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>

From-SVN: r231208
2015-12-02 21:59:05 +00:00
Alessandro Fanfarillo 9315dff064 trans.h (caf_sync_memory): New function decl tree.
2015-03-10  Alessandro Fanfarillo  <fanfarillo.gcc@gmail.com>
            Tobias Burnus  <burnus@net-b.de>

        * trans.h (caf_sync_memory): New function decl tree.
        * trans-decl.c (gfc_build_builtin_function_decls): Define it.
        (create_main_function): Don't call sync_synchronize and leave
        it to the CAF library.
        * trans-stmt.c (gfc_trans_stop): Ditto.
        (gfc_trans_sync): Ditto; add call library call for sync memory.

        * gfortran.dg/coarray_sync_memory.f90: New.

        * caf/libcaf.h (_gfortran_caf_sync_memory): New prototype.
        * caf/single.c (_gfortran_caf_sync_memory): Implement.
        (_gfortran_caf_sync_all, _gfortran_caf_sync_image): Add
        __asm__ __volatile___ ("":::"memory").


Co-Authored-By: Tobias Burnus <burnus@net-b.de>

From-SVN: r221329
2015-03-10 18:58:01 +01:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Tobias Burnus 09de7c2578 single.c (_gfortran_caf_co_reduce): New function.
2015-01-02  Tobias Burnus  <burnus@net-b.de>

        * caf/single.c (_gfortran_caf_co_reduce): New function.
        * caf/libcaf.h (_gfortran_caf_co_reduce): New prototype.

2015-01-02  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/coarray/collectives_4.f90: New.

From-SVN: r219148
2015-01-02 18:42:52 +01:00
Tobias Burnus a16ee37946 check.c (check_co_collective): Renamed from
2014-09-25  Tobias Burnus  <burnus@net-b.de>

gcc/fortran
        * check.c (check_co_collective): Renamed from
        * check_co_minmaxsum,
        handle co_reduce.
        (gfc_check_co_minmax, gfc_check_co_sum): Update call.
        (gfc_check_co_broadcast, gfc_check_co_reduce): New.
        * gfortran.h (gfc_isym_id): Add GFC_ISYM_CO_BROADCAST and
        GFC_ISYM_CO_REDUCE.
        * intrinsic.c (add_subroutines): Add co_reduce and co_broadcast.
        * intrinsic.h (gfc_check_co_broadcast, gfc_check_co_reduce): Add
        proto types.
        * intrinsic.texi (CO_BROADCAST): Add.
        * trans.h (gfor_fndecl_co_broadcast): New.
        * trans-decl.c (gfor_fndecl_co_broadcast): Ditto.
        (gfc_build_builtin_function_decls): Add decl for it,
        * trans-intrinsic.c (conv_co_collective): Renamed from
        conv_co_minmaxsum. Handle co_reduce.
        (gfc_conv_intrinsic_subroutine): Handle co_reduce.

gcc/testsuite/
        * gfortran.dg/coarray/collectives_3.f90: New.
        * gfortran.dg/coarray_collectives_9.f90: New.
        * gfortran.dg/coarray_collectives_10.f90: New.
        * gfortran.dg/coarray_collectives_11.f90: New.
        * gfortran.dg/coarray_collectives_12.f90: New.

libgfortran/
        * caf/libcaf.h (_gfortran_caf_co_broadcast): New prototype.
        * caf/single.c (_gfortran_caf_co_broadcast): New.

From-SVN: r215579
2014-09-25 08:07:15 +02:00
Tobias Burnus 93e2e0465e trans-decl.c (gfc_build_builtin_function_decls): Add may_require_tmp dummy argument.
2014-08-31  Tobias Burnus  <burnus@net-b.de>

gcc/fortran/
        * trans-decl.c (gfc_build_builtin_function_decls): Add
        may_require_tmp dummy argument.
        * trans-intrinsic.c (gfc_conv_intrinsic_caf_get,
        conv_caf_send): Handle may_require_tmp argument.
        (gfc_conv_intrinsic_function): Update call.
        * gfortran.texi (_gfortran_caf_send, _gfortran_caf_get,
        _gfortran_caf_sendget): Update interface description.

gcc/testsuite/
        * gfortran.dg/coarray_lib_comm_1.f90: New.

libgfortran/
        * caf/libcaf.h (_gfortran_caf_send, _gfortran_caf_get,
        _gfortran_caf_sendget): Update prototype.
        * caf/single.c (_gfortran_caf_send, _gfortran_caf_get,
        _gfortran_caf_sendget): Handle may_require_tmp.

From-SVN: r214764
2014-08-31 08:32:06 +02:00
Tobias Burnus bc0229f9f6 gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14  Tobias Burnus  <burnus@net-b.de>

        * gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
        (_gfortran_caf_register): Update for locking/critical.
        (_gfortran_caf_lock, _gfortran_caf_unlock): Add.
        * resolve.c (resolve_critical): New.
        (gfc_resolve_code): Call it.
        * trans-decl.c (gfor_fndecl_caf_critical,
        gfor_fndecl_caf_end_critical): Remove.
        (gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
        (gfc_build_builtin_function_decls): Remove critical,
        assign locking declarations.
        (generate_coarray_sym_init): Handle locking and
        critical variables.
        * trans-stmt.c (gfc_trans_critical): Add calls to
        lock/unlock libcaf functions.
        * trans.h (gfc_coarray_type): Update locking, add
        critical enum values.
        (gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
        (gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.

libgfortran/
2014-08-14  Tobias Burnus  <burnus@net-b.de>

        * caf/libcaf.h (caf_register_t): Update for critical.
        (_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
        (_gfortran_caf_lock, _gfortran_caf_unlock): Add.
        * caf/single.c (_gfortran_caf_register): Handle locking
        variables.
        (_gfortran_caf_sendget): Re-name args for consistency.
        (_gfortran_caf_lock, _gfortran_caf_unlock): Add.

From-SVN: r213979
2014-08-14 20:39:15 +02:00
Tobias Burnus 42a8246dbd libgfortran.h (libcaf_atomic_codes): Add.
2014-07-12  Tobias Burnus  <burnus@net-b.de>

gcc/fortran/
        * libgfortran.h (libcaf_atomic_codes): Add.
        * trans-decl.c (gfor_fndecl_caf_atomic_def,
        gfor_fndecl_caf_atomic_ref, gfor_fndecl_caf_atomic_cas,
        gfor_fndecl_caf_atomic_op): New variables.
        (gfc_build_builtin_function_decls): Initialize them.
        * trans.h (gfor_fndecl_caf_atomic_def,
        gfor_fndecl_caf_atomic_ref, gfor_fndecl_caf_atomic_cas,
        gfor_fndecl_caf_atomic_op): New variables.
        * trans-intrinsic.c (conv_intrinsic_atomic_op,
        conv_intrinsic_atomic_ref, conv_intrinsic_atomic_cas):
        Add library calls with -fcoarray=lib.

libgfortran/
        * caf/libcaf.h (_gfortran_caf_atomic_define,
        _gfortran_caf_atomic_ref, _gfortran_caf_atomic_op,
        _gfortran_caf_atomic_cas): New prototypes.
        * caf/single.c (_gfortran_caf_atomic_define,
        _gfortran_caf_atomic_ref, _gfortran_caf_atomic_op,
        _gfortran_caf_atomic_cas): New functions.

From-SVN: r212484
2014-07-12 21:02:57 +02:00
Tobias Burnus b511626828 check.c (gfc_check_atomic, [...]): Use argument for GFC_ISYM_CAF_GET.
gcc/fortran/
2014-06-17  Tobias Burnus  <burnus@net-b.de>

        * check.c (gfc_check_atomic, gfc_check_atomic_def):
        Use argument for GFC_ISYM_CAF_GET.
        * resolve.c (resolve_variable): Enable CAF_GET insertion.
        (resolve_lock_unlock): Remove GFC_ISYM_CAF_GET.
        (resolve_ordinary_assign): Enable CAF_SEND insertion.
        * trans-const.c (gfc_build_string_const,
        gfc_build_wide_string_const): Set TYPE_STRING_FLAG.
        * trans-decl.c (gfor_fndecl_caf_get, gfor_fndecl_caf_send,
        gfor_fndecl_caf_sendget): New global variables.
        (gfc_build_builtin_function_decls): Initialize them;
        update co_min/max/sum initialization.
        * trans-expr.c (gfc_get_tree_for_caf_expr): Renamed from
        get_tree_for_caf_expr and removed static.
        (gfc_conv_procedure_call): Update call.
        * trans-intrinsic.c (caf_get_image_index,
        conv_caf_vector_subscript_elem, conv_caf_vector_subscript,
        get_caf_token_offset, gfc_conv_intrinsic_caf_get,
        conv_caf_send): New.
        (gfc_conv_intrinsic_function, gfc_conv_intrinsic_subroutine,
        gfc_walk_intrinsic_function): Handle CAF_GET and CAF_SEND.
        (conv_co_minmaxsum): Update call for remove unused vector
        subscript.
        (conv_intrinsic_atomic_def, conv_intrinsic_atomic_ref):
        Skip a CAF_GET of the argument.
        * trans-types.c (gfc_get_caf_vector_type): New.
        * trans-types.h (gfc_get_caf_vector_type): New.
        * trans.h (gfor_fndecl_caf_get, gfor_fndecl_caf_send,
        gfor_fndecl_caf_sendget): New global variables.
        (gfc_get_tree_for_caf_expr): New prototypes.

libgfortran/
2014-06-17  Tobias Burnus  <burnus@net-b.de>

        * caf/libcaf.h (gfc_descriptor_t): New typedef.
        (caf_vector_t): Update.
        (_gfortran_caf_co_sum, _gfortran_caf_co_max, _gfortran_caf_co_min):
        Remove vector-subscript argument.
        (_gfortran_caf_co_send, _gfortran_caf_co_get,
        _gfortran_caf_co_sendget): New.
        * caf/single.c (_gfortran_caf_co_sum, _gfortran_caf_co_max,
        _gfortran_caf_co_min): Remove vector-subscript argument.
        (_gfortran_caf_co_send, _gfortran_caf_co_get,
        _gfortran_caf_co_sendget): New.

gcc/testsuite/
2014-06-17  Tobias Burnus  <burnus@net-b.de>
            Alessandro Fanfarillo <alessandro.fanfarillo@gmail.com>

        * gfortran.dg/coarray/send_array.f90: New.
        * gfortran.dg/coarray/get_array.f90: New.
        * gfortran.dg/coarray/sendget_array.f90: New.
        * gfortran.dg/coarray/collectives_1.f90: Correct subroutine
        names.
        * gfortran.dg/coarray/collectives_2.f90: New.



Co-Authored-By: Alessandro Fanfarillo <alessandro.fanfarillo@gmail.com>

From-SVN: r211748
2014-06-17 22:54:14 +02:00
Tobias Burnus a9fe68774e trans-intrinsic.c (gfc_build_builtin_function_decls): Change type of second argument to int.
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
2014-05-11 20:25:55 +02:00
Tobias Burnus d62cf3dfbe check.c (check_co_minmaxsum, [...]): New.
gcc/fortran/
2014-05-08  Tobias Burnus  <burnus@net-b.de>

        * check.c (check_co_minmaxsum, gfc_check_co_minmax,
        gfc_check_co_sum): New.
        * error.c (gfc_notify_std): Update -std=f2008ts.
        * gfortran.h (gfc_isym_id): Add GFC_ISYM_CO_MAX,
        GFC_ISYM_CO_MIN, GFC_ISYM_CO_SUM.
        * intrinsic.h (gfc_check_co_minmax,
        gfc_check_co_sum): Declare.
        * intrinsic.c (add_subroutines): Add co_min, co_max
        and co_sum.
        (gfc_check_intrinsic_standard): Update text for
        -std=f2008ts.
        * intrinsic.texi (CO_MIN, CO_MAX, CO_SUM): Document
        them.
        * invoke.texi (-std=f2008ts): Update wording.
        * trans.h (gfor_fndecl_co_max,
        gfor_fndecl_co_min, gfor_fndecl_co_sum): Define.
        * trans-decl.c (gfor_fndecl_co_max,
        gfor_fndecl_co_min, gfor_fndecl_co_sum): Define.
        (gfc_build_builtin_function_decls): Assign to it.
        * trans-intrinsic.c (conv_co_minmaxsum): New.
        (gfc_conv_intrinsic_subroutine): Call it.

libgfortran/
2014-05-08  Tobias Burnus  <burnus@net-b.de>

        * caf/libcaf.h (caf_vector_t, _gfortran_caf_co_sum,
        _gfortran_caf_co_min, _gfortran_caf_co_max): Declare
        * caf/single.c

gcc/testsuite/
2014-05-08  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/coarray_collectives_1.f90: New.
        * gfortran.dg/coarray_collectives_2.f90: New.
        * gfortran.dg/coarray_collectives_3.f90: New.
        * gfortran.dg/coarray_collectives_4.f90: New.
        * gfortran.dg/coarray_collectives_5.f90: New.
        * gfortran.dg/coarray_collectives_6.f90: New.
        * gfortran.dg/coarray/collectives_1.f90: New.
        * gfortran.dg/assumed_rank_5.f90: Update dg-error.
        * gfortran.dg/assumed_type_4.f90: Update dg-error.
        * gfortran.dg/bind_c_array_params.f03: Update dg-error.
        * gfortran.dg/bind_c_usage_28.f90: Update dg-error.
        * gfortran.dg/c_funloc_tests_5.f03: Update dg-error.
        * gfortran.dg/c_funloc_tests_6.f90: Update dg-error.
        * gfortran.dg/c_loc_tests_11.f03: Update dg-error.

From-SVN: r210223
2014-05-08 18:55:23 +02:00
Tobias Burnus a8a5f4a972 gfortran.h (gfc_init_coarray_decl): Remove.
2014-04-30  Tobias Burnus  <burnus@net-b.de>

        * gfortran.h (gfc_init_coarray_decl): Remove.
        * parse.c (translate_all_program_units): Remove call to it.
        (gfc_parse_file): Update call.
        * trans.h (gfor_fndecl_caf_this_image,
        gfor_fndecl_caf_num_images): Add.
        (gfort_gvar_caf_num_images,
        gfort_gvar_caf_this_image): Remove.
        * trans-decl.c (gfor_fndecl_caf_this_image,
        gfor_fndecl_caf_num_images): Add.
        (gfort_gvar_caf_num_images,
        gfort_gvar_caf_this_image): Remove.
        (gfc_build_builtin_function_decls): Init new decl.
        (gfc_init_coarray_dec): Remove.
        (create_main_function): Change calls.
        * trans-intrinsic.c (trans_this_image, trans_image_index,
        conv_intrinsic_cobound): Generate call to new library function
        instead of to a static variable.
        * trans-stmt.c (gfc_trans_sync): Ditto.

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

        * gfortran.dg/coarray_lib_this_image_1.f90: New.
        * gfortran.dg/coarray_lib_this_image_2.f90: New.

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

        * caf/libcaf.h (_gfortran_caf_this_image,
        * _gfortran_caf_num_images):
        New prototypes.
        (_gfortran_caf_init): Change prototype.
        (mpi_token_t): New typedef.
        (TOKEN): New define.
        * caf/mpi.c (_gfortran_caf_this_image,
        * _gfortran_caf_num_images):
        New functions.
        (_gfortran_caf_init): Update.
        (_gfortran_caf_finalize, _gfortran_caf_register,
        _gfortran_caf_deregister): Use mpi_token_t.
        * caf/single.c (_gfortran_caf_this_image,
        * _gfortran_caf_num_images):
        New functions.
        (_gfortran_caf_init): Update.
        (_gfortran_caf_finalize, _gfortran_caf_register,
        _gfortran_caf_deregister): Use mpi_token_t, simplify.

From-SVN: r209951
2014-04-30 21:02:23 +02:00
Richard Sandiford f0bcf62899 Update copyright years in libgfortran/
From-SVN: r206296
2014-01-02 22:25:45 +00:00
David Edelsohn 13c4975c2d libcaf.h (_gfortran_caf_critical): Add a prototype.
* caf/libcaf.h (_gfortran_caf_critical): Add a prototype.
        (_gfortran_caf_end_critical): Same.

From-SVN: r198613
2013-05-05 19:47:22 -04:00
Richard Sandiford e3c063ceda Update copyright years in libgfortran.
From-SVN: r195167
2013-01-14 18:20:58 +00:00
Tobias Burnus 5d81ddd07f 2012-01-06 Tobias Burnus <burnus@net-b.de>
* trans-openmp.c (gfc_omp_clause_dtor,
        * gfc_trans_omp_array_reduction):
        Update call to gfc_trans_dealloc_allocated.
        * trans.c (gfc_allocate_using_malloc): Fix spacing.
        (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to
        label_finish when an error occurs.
        (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib.
        * trans.h (gfc_allocate_allocatable,
        * gfc_deallocate_with_status):
        Update prototype.
        (gfor_fndecl_caf_deregister): New tree symbol.
        * trans-expr.c (gfc_conv_procedure_call): Update
        gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls.
        * trans-array.c (gfc_array_allocate,
        * gfc_trans_dealloc_allocated,
        structure_alloc_comps, gfc_trans_deferred_array): Ditto.
        (gfc_array_deallocate): Handle coarrays with -fcoarray=lib.
        * trans-array.h (gfc_array_deallocate, gfc_array_allocate,
        gfc_trans_dealloc_allocated): Update prototypes.
        * trans-stmt.c (gfc_trans_sync): Fix indentation.
        (gfc_trans_allocate): Fix errmsg padding and label handling.
        (gfc_trans_deallocate): Ditto and handle -fcoarray=lib.
        * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS.
        * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value
        to avoid other stats accidentally matching this one.
        * trans-decl.c (gfor_fndecl_caf_deregister): New global var.
        (gfc_build_builtin_function_decls): Fix prototype decl of caf_register
        and add decl for caf_deregister.
        (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib.
        * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to
        gfc_deallocate_with_status.

2012-01-06  Tobias Burnus <burnus@net-b.de>

        * caf/single.c (_gfortran_caf_register,
        * _gfortran_caf_deregister):
        Fix token handling.
        * caf/mpi.c  (_gfortran_caf_register, _gfortran_caf_deregister):
        * Ditto.
        * caf/libcaf.h (STAT_STOPPED_IMAGE): Sync with libgfortran.h.
        (_gfortran_caf_register, _gfortran_caf_deregister): Update prototype.

2012-01-06  Tobias Burnus <burnus@net-b.de>

        * gfortran.dg/deallocate_stat_2.f90: New.
        * coarray/allocate_errgmsg.f90: New.
        * gfortran.dg/coarray_lib_alloc_1.f90: New.
        * gfortran.dg/coarray_lib_alloc_2.f90: New.
        * coarray/subobject_1.f90: Fix for num_images > 1.
        * gfortran.dg/deallocate_stat.f90: Update due to changed
        stat= handling.

From-SVN: r182951
2012-01-06 14:38:49 +01:00
Tobias Burnus 86187d0fe0 trans-decl.c (generate_coarray_sym_init): Use GFC_CAF_COARRAY_STATIC for static coarrays.
gcc/fortran/
2011-08-29  Tobias Burnus  <burnus@net-b.de>

        * trans-decl.c (generate_coarray_sym_init): Use
        GFC_CAF_COARRAY_STATIC for static coarrays.

libgfortan/
2011-08-29  Tobias Burnus  <burnus@net-b.de>

        * caf/libcaf.h (_gfortran_caf_deregister): Update prototype.
        * caf/mpi.c (_gfortran_caf_deregister): Modify prototype,
        actually free memory and add error diagnostic.
        (_gfortran_caf_finalize): Add additional free calls.
        * caf/single.c (_gfortran_caf_deregister): Modify prototype,
        actually free memory and add error diagnostic.
        (_gfortran_caf_finalize): Add additional free calls.

From-SVN: r178193
2011-08-29 12:33:09 +02:00
Tobias Burnus 4054bc52d6 trans.c (gfc_allocate_with_status): Call _gfortran_caf_register with NULL arguments for (new) stat=/errmsg= arguments.
2011-07-07  Tobias Burnus  <burnus@net-b.de>

        * trans.c (gfc_allocate_with_status): Call _gfortran_caf_register
        with NULL arguments for (new) stat=/errmsg= arguments.

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

        * libcaf.h (__attribute__, unlikely, likely): New macros.
        (caf_register_t): Update comment.
        (_gfortran_caf_register): Add stat, errmsg, errmsg_len arguments.
        * single.c (_gfortran_caf_register): Ditto; add error diagnostics.
        * mpi.c (_gfortran_caf_register): Ditto.
        (caf_is_finalized): New global variable.
        (_gfortran_caf_finalize): Use it.

From-SVN: r175966
2011-07-07 14:46:18 +02:00
Daniel Carrera 0a1138af63 single.c (_gfortran_caf_register): Store the address of all static coarrays in a linked list.
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
2011-06-17 01:09:36 +02:00
Daniel Carrera f5c01f5bde trans-decl.c (gfc_build_builtin_function_decls): Updated declaration of caf_sync_all and caf_sync_images.
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-06-10 12:22:24 +02:00
Tobias Burnus cc9ae24cbe re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-05-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * caf/libcaf.h: Cleanup headers.
        (_gfortran_caf_critical, _gfortran_caf_end_critical): Make stub.
        (caf_register_t): New enum.
        (_gfortran_caf_register, _gfortran_caf_deregister): New prototype.
        * caf/single.c (_gfortran_caf_critical,
        _gfortran_caf_end_critical): Remove.
        (_gfortran_caf_register, _gfortran_caf_deregister): New functions.
        * caf/mpi.c (_gfortran_caf_critical,
        _gfortran_caf_end_critical): Remove.
        (_gfortran_caf_register, _gfortran_caf_deregister): New functions.
        (caf_world_window): Remove global variable.
        (_gfortran_caf_init): Fix off-by-one error of this_image.

From-SVN: r173505
2011-05-06 20:35:00 +02:00
Tobias Burnus 5092eb960c re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-03-27  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * caf/libcaf.h: New - coarray communication library.
        * caf/mpi.c: New.
        * caf/single.c: New.

From-SVN: r171570
2011-03-27 11:01:34 +02:00