[patch, shared coarrays, committed] Fix

Thomas Koenig tkoenig@netcologne.de
Wed Dec 30 17:09:04 GMT 2020


Hello world,

I just committed the attached patch to the branch
as 
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=4726e39b0be3c0bc55e43d2d300f0d0b9529d883 
.

It is sometimes astonishing, if you shake code
a bit, how many bugs came crawling out :-)

Best regards

	Thomas


Make STAT and ERRMSG work on ALLOCATE, move error handling to library.

This makes STAT and ERRMSG work on ALLOCATE.  It also separates
the allocation of coarrays into two functions: One without error
checking, which is called by compiler-generated code, and one
with error checking for call from user code.

In the course of looking at this, it was also noticed that
allocatable coarrays were not automatically deallocated;
this is now also fixed.  Also, saved allocatable coarrays
are now saved.

gcc/fortran/ChangeLog:

	* trans-array.c (gfc_allocate_shared_coarray): Remove extra
	arguments, just build the call.
	(allocate_shared_coarray_chk): New function.
	(gfc_array_allocate): Adjust where to set the offset.
	Error handling is done in the library for shared coarrays.
	(gfc_trans_deferred_array): No early return for allocatable
	shared coarrays.
	* trans-array.h (gfc_array_allocate): Adjust prototype.
	(gfc_allocate_shared_coarray): Likewise.
	* trans-decl.c: Rename gfor_fndecl_cas_coarray_allocate to
	gfor_fndecl_cas_coarray_alloc for
	brevity.  Add gfor_fndecl_cas_coarray_alloc_chk.
	(gfc_build_builtin_function_decls): Likewise.
	(gfc_trans_shared_coarray): Adjust calling sequence for
	gfc_allocate_shared_coarray.
	(gfc_trans_deferred_vars): Correct handling of saved
	allocatable shared coarrays.
	* trans-stmt.c (gfc_trans_sync): Adjust whitespace.o
	(coarray_alloc_p): Remove.
	(gfc_trans_allocate): Add shared_coarray variable to adjust
	status and errmsg handling.
	* trans.h: Rename gfor_fndecl_cas_coarray_allocate to
	gfor_fndecl_cas_coarray_alloc for brevity.  Add
	gfor_fndecl_cas_coarray_alloc_chk.

libgfortran/ChangeLog:

	* caf_shared/coarraynative.c (test_for_cas_errors): Correct
	handling of stat.
	* caf_shared/libcoarraynative.h (STAT_ERRMSG_ENTRY_CHECK): Use
	unlikely in condition.
	(STAT_ERRMSG_ENTRY_CHECK_RET): Likewise.
	* caf_shared/wrapper.c (cas_coarray_alloc): Adjust arguments.
	Call cas_coarray_alloc_work.
	(cas_coarray_alloc_chk): New function.
	(cas_coarray_alloc_work): New function.

gcc/testsuite/ChangeLog:

	* gfortran.dg/caf-shared/allocate_1.f90: Adjust number of calls to
	sync_all.
	* gfortran.dg/caf-shared/allocate_status_1.f90: New test.
	* gfortran.dg/caf-shared/automatic_deallocate_1.f90: New test.
	* gfortran.dg/caf-shared/save_allocatable_1.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.txt
Type: text/x-patch
Size: 25514 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20201230/1cb32bba/attachment-0001.bin>


More information about the Fortran mailing list