aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorvehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-05 11:35:47 +0000
committervehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-05 11:35:47 +0000
commitd9ca273e35460d5d719956555ed5ca738e6680ef (patch)
tree992e5a7217ac50b58fd957616898363d731e3380 /libgfortran
parentc125a3f7734b7793ce079d7642223afc6a66b2a5 (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245900 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog10
-rw-r--r--libgfortran/caf/libcaf.h27
-rw-r--r--libgfortran/caf/single.c71
3 files changed, 102 insertions, 6 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index ec689fd7285..edb416bde94 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
2017-03-02 Thomas Koenig <tkoenig@gcc.gnu.org>
Jakub Jelinek <jakub@redhat.com>
diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index 5c39202877d..24726462e89 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -41,14 +41,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
+#endif
/* Definitions of the Fortran 2008 standard; need to kept in sync with
- ISO_FORTRAN_ENV, cf. libgfortran.h. */
-#define STAT_UNLOCKED 0
-#define STAT_LOCKED 1
-#define STAT_LOCKED_OTHER_IMAGE 2
-#define STAT_STOPPED_IMAGE 6000
-#endif
+ ISO_FORTRAN_ENV, cf. gcc/fortran/libgfortran.h. */
+typedef enum
+{
+ CAF_STAT_UNLOCKED = 0,
+ CAF_STAT_LOCKED,
+ CAF_STAT_LOCKED_OTHER_IMAGE,
+ CAF_STAT_STOPPED_IMAGE = 6000,
+ CAF_STAT_FAILED_IMAGE = 6001
+}
+caf_stat_codes_t;
+
/* Describes what type of array we are registerring. Keep in sync with
gcc/fortran/trans.h. */
@@ -74,6 +80,7 @@ typedef enum caf_deregister_t {
caf_deregister_t;
typedef void* caf_token_t;
+typedef void * caf_team_t;
typedef gfc_array_void gfc_descriptor_t;
/* Linked list of static coarrays registered. */
@@ -198,6 +205,7 @@ void _gfortran_caf_stop_str (const char *, int32_t)
void _gfortran_caf_error_stop_str (const char *, int32_t)
__attribute__ ((noreturn));
void _gfortran_caf_error_stop (int32_t) __attribute__ ((noreturn));
+void _gfortran_caf_fail_image (void) __attribute__ ((noreturn));
void _gfortran_caf_co_broadcast (gfc_descriptor_t *, int, int *, char *, int);
void _gfortran_caf_co_sum (gfc_descriptor_t *, int, int *, char *, int);
@@ -243,6 +251,13 @@ void _gfortran_caf_event_post (caf_token_t, size_t, int, int *, char *, int);
void _gfortran_caf_event_wait (caf_token_t, size_t, int, int *, char *, int);
void _gfortran_caf_event_query (caf_token_t, size_t, int, int *, int *);
+void _gfortran_caf_failed_images (gfc_descriptor_t *,
+ caf_team_t * __attribute__ ((unused)), int *);
+int _gfortran_caf_image_status (int, caf_team_t * __attribute__ ((unused)));
+void _gfortran_caf_stopped_images (gfc_descriptor_t *,
+ caf_team_t * __attribute__ ((unused)),
+ int *);
+
int _gfortran_caf_is_present (caf_token_t, int, caf_reference_t *);
#endif /* LIBCAF_H */
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 8d3bcbfb80e..bf1a2299754 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -264,6 +264,7 @@ _gfortran_caf_sync_images (int count __attribute__ ((unused)),
*stat = 0;
}
+
void
_gfortran_caf_stop_numeric(int32_t stop_code)
{
@@ -271,6 +272,7 @@ _gfortran_caf_stop_numeric(int32_t stop_code)
exit (0);
}
+
void
_gfortran_caf_stop_str(const char *string, int32_t len)
{
@@ -282,6 +284,7 @@ _gfortran_caf_stop_str(const char *string, int32_t len)
exit (0);
}
+
void
_gfortran_caf_error_stop_str (const char *string, int32_t len)
{
@@ -294,6 +297,74 @@ _gfortran_caf_error_stop_str (const char *string, int32_t len)
}
+/* Reported that the program terminated because of a fail image issued.
+ Because this is a single image library, nothing else than aborting the whole
+ program can be done. */
+
+void _gfortran_caf_fail_image (void)
+{
+ fputs ("IMAGE FAILED!\n", stderr);
+ exit (0);
+}
+
+
+/* Get the status of image IMAGE. Because being the single image library all
+ other images are reported to be stopped. */
+
+int _gfortran_caf_image_status (int image,
+ caf_team_t * team __attribute__ ((unused)))
+{
+ if (image == 1)
+ return 0;
+ else
+ return CAF_STAT_STOPPED_IMAGE;
+}
+
+
+/* Single image library. There can not be any failed images with only one
+ image. */
+
+void
+_gfortran_caf_failed_images (gfc_descriptor_t *array,
+ caf_team_t * team __attribute__ ((unused)),
+ int * kind)
+{
+ int local_kind = kind != NULL ? *kind : 4;
+
+ array->base_addr = NULL;
+ array->dtype = ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT)
+ | (local_kind << GFC_DTYPE_SIZE_SHIFT));
+ /* Setting lower_bound higher then upper_bound is what the compiler does to
+ indicate an empty array. */
+ array->dim[0].lower_bound = 0;
+ array->dim[0]._ubound = -1;
+ array->dim[0]._stride = 1;
+ array->offset = 0;
+}
+
+
+/* With only one image available no other images can be stopped. Therefore
+ return an empty array. */
+
+void
+_gfortran_caf_stopped_images (gfc_descriptor_t *array,
+ caf_team_t * team __attribute__ ((unused)),
+ int * kind)
+{
+ int local_kind = kind != NULL ? *kind : 4;
+
+ array->base_addr = NULL;
+ array->dtype = ((BT_INTEGER << GFC_DTYPE_TYPE_SHIFT)
+ | (local_kind << GFC_DTYPE_SIZE_SHIFT));
+ /* Setting lower_bound higher then upper_bound is what the compiler does to
+ indicate an empty array. */
+ array->dim[0].lower_bound = 0;
+ array->dim[0]._ubound = -1;
+ array->dim[0]._stride = 1;
+ array->offset = 0;
+}
+
+
void
_gfortran_caf_error_stop (int32_t error)
{