diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-12-30 17:53:31 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-12-30 17:53:31 +0100 |
commit | 4726e39b0be3c0bc55e43d2d300f0d0b9529d883 (patch) | |
tree | e43bd7824dec4baaae0482ee651d239e2840c684 /gcc/cppdefault.c | |
parent | 2b0eabeb48d63234a3dbaad9c1f4d81305439b3e (diff) | |
download | gcc-4726e39b0be3c0bc55e43d2d300f0d0b9529d883.zip gcc-4726e39b0be3c0bc55e43d2d300f0d0b9529d883.tar.gz gcc-4726e39b0be3c0bc55e43d2d300f0d0b9529d883.tar.bz2 |
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.
Diffstat (limited to 'gcc/cppdefault.c')
0 files changed, 0 insertions, 0 deletions